KERAS模型性能变化

发布于 2025-02-11 08:11:36 字数 798 浏览 1 评论 0原文

我正在学习神经网络的学习曲线,使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文