KERAS模型性能变化
我正在学习神经网络的学习曲线,使用Keras根据先前的指定窗口来预测下一个值。这是我的代码
from sklearn.preprocessing import MinMaxScaler,StandardScaler
from keras.preprocessing.sequence import TimeseriesGenerator
scaler = StandardScaler() scaler.fit(train)
scaled_train = scaler.transform(train)
scaled_test = scaler.transform(test)
# define generator
n_input = 47
n_features = 1
generator = TimeseriesGenerator(scaled_train, scaled_train, length = n_input, batch_size=12)
initializer = tf.keras.initializers.GlorotNormal()
model = Sequential()
model.add(LSTM(12,activation = 'relu', input_shape = (n_input, n_features),kernel_initializer = initializer))
model.add(Dense(1))
model.compile(optimizer = 'adam', loss = 'mae')
问题,每次我重新训练模型而无需进行任何更改时,我的模型性能就会更改。通常,它应该根据参数的任何更改(例如新隐藏层或激活功能的更改等)进行更改
I am on learning curve of neural network , using Keras to forecast next value based on previous specified window. Here is my code
from sklearn.preprocessing import MinMaxScaler,StandardScaler
from keras.preprocessing.sequence import TimeseriesGenerator
scaler = StandardScaler() scaler.fit(train)
scaled_train = scaler.transform(train)
scaled_test = scaler.transform(test)
# define generator
n_input = 47
n_features = 1
generator = TimeseriesGenerator(scaled_train, scaled_train, length = n_input, batch_size=12)
initializer = tf.keras.initializers.GlorotNormal()
model = Sequential()
model.add(LSTM(12,activation = 'relu', input_shape = (n_input, n_features),kernel_initializer = initializer))
model.add(Dense(1))
model.compile(optimizer = 'adam', loss = 'mae')
Problem is every time when I retrain model without making any changes , my model performance gets changed. Normally it should change based on any changes in parameter e.g. (new hidden layers or changes in activation function etc)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论