Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 神经网络回归预测所有测试样本的相同值_Python_Machine Learning_Neural Network_Regression_Keras - Fatal编程技术网

Python 神经网络回归预测所有测试样本的相同值

Python 神经网络回归预测所有测试样本的相同值,python,machine-learning,neural-network,regression,keras,Python,Machine Learning,Neural Network,Regression,Keras,我的神经网络回归模型预测所有测试样本的一个值。使用超参数,如年代、批次大小、层数、隐藏单位、学习率等,只会将预测值更改为新常量 对于测试,如果我对训练数据本身进行测试,我会得到几乎准确的结果和RMSE~1 注:任务是预测机器从运行到故障的剩余寿命时间序列数据。我使用tsfresh库从只有24个特征的原始时间序列数据生成了1045个特征 是什么导致了这种行为?我应该如何可视化神经网络模型开发,以确保事情朝着正确的方向发展? 输出: Shape of training_features is (24

我的神经网络回归模型预测所有测试样本的一个值。使用超参数,如年代、批次大小、层数、隐藏单位、学习率等,只会将预测值更改为新常量

对于测试,如果我对训练数据本身进行测试,我会得到几乎准确的结果和RMSE~1

注:任务是预测机器从运行到故障的剩余寿命时间序列数据。我使用tsfresh库从只有24个特征的原始时间序列数据生成了1045个特征

是什么导致了这种行为?我应该如何可视化神经网络模型开发,以确保事情朝着正确的方向发展?

输出:

Shape of training_features is (249, 1045)
Shape of train_labels is (249,)
Shape of test_features is (248, 1045)
shape of test_labels is (248,)

...BEGIN SEARCH...

Let's fit the training data...
Fitting 5 folds for each of 1 candidates, totalling 5 fits
Best: -891.761863 using {'learn_rate': 0.0001, 'h2': 15, 'act1': 'sigmoid', 'act2': 'sigmoid', 'h1': 75, 'batch_size': 8, 'init': 'glorot_uniform', 'nb_epoch': 500, 'momentum': 0.1}
-891.761863 (347.253351) with: {'learn_rate': 0.0001, 'h2': 15, 'act1': 'sigmoid', 'act2': 'sigmoid', 'h1': 75, 'batch_size': 8, 'init': 'glorot_uniform', 'nb_epoch': 500, 'momentum': 0.1}

Prediction array is
[ 295.72067261  295.72067261  295.72067261  295.72067261  295.72067261
  295.72067261  295.72067261  ...
                              295.72067261  295.72067261  295.72067261
  295.72067261  295.72067261  295.72067261]
Test RMSE is 95.0019297411

您应该尝试缩放数据。这通常发生在未缩放特征时。

那么您使用249个样本和1045个特征来训练神经网络?这可能会导致严重的过度装配。我建议你获取更多数据或减少功能的数量。我认为我没有办法获取更多数据(研究项目)。但问题是“过度拟合模型为什么要预测所有相同的值”?它是否应该为不同的测试特征向量提供错误/随机的值?尝试将
activations
更改为
relu
initializer
更改为
glorot\u normal
he_normal
用于
relu
。使用
sigmoid
被认为不是最好的主意-你可能会遇到渐变消失-特别是当你用
he
初始化
sigmoid
时,你的
lr
动量
都很小。我想我也尝试过这些组合。但是,我会在尝试更多你的建议后再次报告。我所做的大多是经验性的、尝试性的;我希望我能想象下事情是如何展开的。不过谢谢:)
Shape of training_features is (249, 1045)
Shape of train_labels is (249,)
Shape of test_features is (248, 1045)
shape of test_labels is (248,)

...BEGIN SEARCH...

Let's fit the training data...
Fitting 5 folds for each of 1 candidates, totalling 5 fits
Best: -891.761863 using {'learn_rate': 0.0001, 'h2': 15, 'act1': 'sigmoid', 'act2': 'sigmoid', 'h1': 75, 'batch_size': 8, 'init': 'glorot_uniform', 'nb_epoch': 500, 'momentum': 0.1}
-891.761863 (347.253351) with: {'learn_rate': 0.0001, 'h2': 15, 'act1': 'sigmoid', 'act2': 'sigmoid', 'h1': 75, 'batch_size': 8, 'init': 'glorot_uniform', 'nb_epoch': 500, 'momentum': 0.1}

Prediction array is
[ 295.72067261  295.72067261  295.72067261  295.72067261  295.72067261
  295.72067261  295.72067261  ...
                              295.72067261  295.72067261  295.72067261
  295.72067261  295.72067261  295.72067261]
Test RMSE is 95.0019297411