Sklearn MPLClassifier不适用于训练集

时间:2016-12-31 22:54:00

标签: scikit-learn

我正在尝试开发MPLClassifier神经网络。当我在一些数据上测试我的模型时,我发现结果完全不是我所期望的,所以我在训练的数据上测试了模型。尽管如此,预测并不是很准确。以下是我的代码。

>>> mlp = MLPClassifier(solver='lbfgs', hidden_layer_sizes = (100,1000,100),max_iter=30000)
>>> mlp.fit(i, t)
MLPClassifier(activation='relu', alpha=0.0001, batch_size='auto', beta_1=0.9,
       beta_2=0.999, early_stopping=False, epsilon=1e-08,
       hidden_layer_sizes=(100, 1000, 100), learning_rate='constant',
       learning_rate_init=0.001, max_iter=30000, momentum=0.9,
       nesterovs_momentum=True, power_t=0.5, random_state=None,
       shuffle=True, solver='lbfgs', tol=0.0001, validation_fraction=0.1,
       verbose=False, warm_start=False)
>>> mlp.predict(i)
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
>>> t
array([0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1])
>>> i
array([[  8.00000000e+00,   7.50000000e+04,   7.90000000e+01,
          1.00000000e+00,   6.20000000e+01,   7.63000000e+02,
          0.00000000e+00],
       [  7.75000000e+00,   1.23000000e+05,   8.00000000e+01,
          1.00000000e+00,   2.80000000e+01,   7.50000000e+02,
          0.00000000e+00],
       [  8.50000000e+00,   5.10000000e+04,   9.50000000e+01,
          1.00000000e+00,   2.70000000e+01,   6.86000000e+02,
          0.00000000e+00],
       [  8.75000000e+00,   2.42000000e+05,   9.50000000e+01,
          1.00000000e+00,   4.70000000e+01,   7.06000000e+02,
          0.00000000e+00],
       [  8.25000000e+00,   2.40000000e+05,   7.70000000e+01,
          2.00000000e+00,   1.90000000e+01,   7.37000000e+02,
          0.00000000e+00],
       [  7.62500000e+00,   2.25000000e+05,   6.40000000e+01,
          2.00000000e+00,   2.10000000e+01,   7.93000000e+02,
          0.00000000e+00],
       [  8.00000000e+00,   1.20000000e+05,   7.50000000e+01,
          2.00000000e+00,   3.60000000e+01,   7.50000000e+02,
          1.00000000e+00],
       [  8.00000000e+00,   1.30000000e+05,   6.10000000e+01,
          2.00000000e+00,   3.40000000e+01,   6.46000000e+02,
          0.00000000e+00],
       [  8.37500000e+00,   1.07000000e+05,   9.50000000e+01,
          1.00000000e+00,   3.70000000e+01,   6.76000000e+02,
          0.00000000e+00],
       [  7.87500000e+00,   6.00000000e+04,   7.40000000e+01,
          2.00000000e+00,   1.70000000e+01,   7.81000000e+02,
          0.00000000e+00],
       [  7.75000000e+00,   1.53000000e+05,   8.00000000e+01,
          1.00000000e+00,   4.50000000e+01,   7.61000000e+02,
          0.00000000e+00],
       [  8.25000000e+00,   1.37000000e+05,   8.00000000e+01,
          1.00000000e+00,   3.40000000e+01,   7.47000000e+02,
          0.00000000e+00],
       [  7.75000000e+00,   1.52000000e+05,   8.50000000e+01,
          1.00000000e+00,   4.10000000e+01,   6.04000000e+02,
          0.00000000e+00],
       [  8.00000000e+00,   8.40000000e+04,   7.50000000e+01,
          2.00000000e+00,   5.70000000e+01,   6.76000000e+02,
          0.00000000e+00],
       [  7.75000000e+00,   1.06000000e+05,   8.00000000e+01,
          2.00000000e+00,   2.70000000e+01,   6.52000000e+02,
          0.00000000e+00],
       [  8.12500000e+00,   1.29000000e+05,   9.30000000e+01,
          2.00000000e+00,   3.60000000e+01,   6.68000000e+02,
          1.00000000e+00],
       [  6.32000000e+00,   6.40000000e+04,   8.00000000e+01,
          1.00000000e+00,   5.20000000e+01,   5.88000000e+02,
          1.00000000e+00],
       [  8.12500000e+00,   2.35000000e+05,   5.80000000e+01,
          2.00000000e+00,   4.70000000e+01,   7.16000000e+02,
          0.00000000e+00],
       [  8.00000000e+00,   1.65000000e+05,   4.60000000e+01,
          2.00000000e+00,   2.80000000e+01,   6.57000000e+02,
          1.00000000e+00],
       [  7.87500000e+00,   4.00000000e+04,   6.60000000e+01,
          2.00000000e+00,   2.50000000e+01,   7.97000000e+02,
          0.00000000e+00],
       [  7.37500000e+00,   6.00000000e+04,   7.10000000e+01,
          1.00000000e+00,   8.00000000e+00,   7.66000000e+02,
          1.00000000e+00]])

0 个答案:

没有答案