【发布时间】:2019-08-06 01:38:51
【问题描述】:
我正在使用带有以下参数的 scikit learn 的 MLPClassifier
mlp = MLPClassifier(hidden_layer_sizes=(3,2,),solver='sgd', verbose=True,
learning_rate='constant',learning_rate_init=0.001, random_state=rr,
warm_start=True, max_iter=400, n_iter_no_change=20)
我想在不同但非常相似的数据上拟合我的分类器,并查看 NN 需要多长时间才能收敛。
我生成了一个非常简单的数据集。 It is a data set of 50,000 (x,y) points and the colours denote how I have classified the points.
我的分类器最初是在第一个图上训练的,然后我做了
mlp.fit(new_data, new_data_labels)
对于每个图,new_data = 我的旧数据 + 新数据集。
这运行良好,但是,当我将分类器拟合到我的新的、更大的数据集时,它会在一次迭代中收敛。似乎无论我如何改变我的分类器覆盖范围的数据,但my loss graph looks terrible。我不太确定我哪里出错了。
我的输出看起来像这样
Iteration 134, loss = 0.55557070
Iteration 135, loss = 0.55550839
Training loss did not improve more than tol=0.000100 for 20 consecutive epochs. Stopping.
Training set score: 0.663680
Training set loss: 0.555508
Iteration 136, loss = 0.56689723
Training loss did not improve more than tol=0.000100 for 20 consecutive epochs. Stopping.
Training set score: 0.643810
Training set loss: 0.566897
Iteration 137, loss = 0.57723775
Training loss did not improve more than tol=0.000100 for 20 consecutive epochs. Stopping.
Training set score: 0.624447
Training set loss: 0.577238
Iteration 138, loss = 0.58684895
Training loss did not improve more than tol=0.000100 for 20 consecutive epochs. Stopping.
【问题讨论】:
-
我相信简化但完整的代码会有所帮助
标签: python scikit-learn