Why does a neural network trained with random data and fixed initialization have different weights between runs? I wrote a simple code that creates a neural network with two dense layers and then trains it. In this code, the initial coefficients of each layer are fixed. Why do the answers change every time? (In situations where layers such as dropout are not used and the initial coefficients are also fixed)
```
import numpy as np
import keras
from keras import layers

x = np.random.random([200,4])
y = np.random.random([200,1])

model = keras.Sequential()
model.add(layers.Dense(units=4,activation='relu',input_shape (x.shape[1:]),kernel_initializer='ones',bias_initializer='ones'))
model.add(layers.Dense(units=1,kernel_initializer='ones',bias_initializer='ones'))
opt = keras.optimizers.Adam(learning_rate = 0.0001)
model.compile(loss = keras.losses.categorical_crossentropy, optimizer= opt, metrics=['mae'])

history = model.fit(x, y, epochs=50)
```


Your input and output are random. Every time you run the code, they take different values; of course the neural network gives different results for the different data.
This turns out not to be a statistics problem. Just stick np.random.seed(2022) (or some other number, but I learned to go with the year from our late friend, BruceET) at the top of your code to lock in your $X$ and $y$ variables. The generation of those variables will be random, but it will be the same random generation every time you run the code.
