# I am getting different mean_absolute_error when i retrain my model everything same

I have set my numpy random seed to 0. I am training on colab and using keras. I didn't change anything. I just re-ran my cell and the val_absolute_error changed.

### Code:

np.random.seed(0)
regressor = Sequential()
model = regressor.fit(X_train, y_train, epochs=450, batch_size=10, validation_data=(X_val, y_val), verbose=1)

print(regressor.evaluate(X_test, y_test)) --> This is the error on the test set


Please note that I made a mistake in the screenshot, it is the error in test set not val. set

• Do you set the random seed before splitting the data into training set and test set? If you use train_test_split from scikit-learn the split will be randomised. – Louic May 26 '19 at 18:17
• May I add: the test/train split is different (pseudo random) if you dont fix the random state by using a seed. Also the model results are non-deterministic. For fully reproduceable results, alway choose a random state via setting a seed. – Peter May 26 '19 at 19:01

from tensorflow import set_random_seed

have you checked the versions of the libraries you're using? I use % pip freeze to check. Perhaps there is something inconsistent that causes this difference. It looks like you've already got your seed set, so you're good there.