If you want to initiate the network with the same weights every time to repeat some experiments, you should set the random, or the network will initiate it randomly......
Pls refer to the following code....
from keras.models import Sequential
from keras.layers import Dense, Activation
import numpy as np
np.random.seed(2016)
#if you set here, then every time, you can initiate the model with the same weights
model = Sequential([
Dense(3, input_dim=784),
Activation('relu'),
Dense(10),
Activation('softmax'),
])
model.compile(optimizer='rmsprop',
loss='categorical_crossentropy',
metrics=['accuracy'])
for layer in model.layers:
weights = layer.get_weights()
print(weights)
在 2016年9月13日星期二 UTC+8下午9:38:21,
matthew...@gmail.com写道: