C2W3_Lab_01_Model_Evaluation_and_Selection: getting random results for mse

I copied the code (including build_models method) of neural networks to my kaggle with the same data. But every time i run it, i get random mse results. Why is that?

def build_models():
    
    tf.random.set_seed(20)
    
    model_1 = Sequential(
        [
            Dense(25, activation = 'relu'),
            Dense(15, activation = 'relu'),
            Dense(1, activation = 'linear')
        ],
        name='model_1'
    )

    model_2 = Sequential(
        [
            Dense(20, activation = 'relu'),
            Dense(12, activation = 'relu'),
            Dense(12, activation = 'relu'),
            Dense(20, activation = 'relu'),
            Dense(1, activation = 'linear')
        ],
        name='model_2'
    )

    model_3 = Sequential(
        [
            Dense(32, activation = 'relu'),
            Dense(16, activation = 'relu'),
            Dense(8, activation = 'relu'),
            Dense(4, activation = 'relu'),
            Dense(12, activation = 'relu'),
            Dense(1, activation = 'linear')
        ],
        name='model_3'
    )
    
    model_list = [model_1, model_2, model_3]
    
    return model_list

RESULTS:
Model 1: Training MSE: 406.19, CV MSE: 551.78
Model 2: Training MSE: 73.40, CV MSE: 112.33
Model 3: Training MSE: 406.19, CV MSE: 551.78

RESULTS:
Model 1: Training MSE: 406.19, CV MSE: 551.78
Model 2: Training MSE: 73.78, CV MSE: 117.64
Model 3: Training MSE: 73.40, CV MSE: 112.29

Not sure about your specific situation.

But, note that NN’s do not have convex cost functions. Each time you run the model, you’ll get different initial weights, and that may give different minimum costs.

Note also that deep neural networks (like your model that has six layers) can take substantially longer to train - so the results may vary wildly if you don’t run enough iterations.

im literally running the same thing from the lab, but in my private kaggle notebook.
Why in the lab results are consistent every single run, while Im getting different numbers?
I am not re-instantiating my models, just re-running fit

Sorry, I do not have any ideas on that.