首页 > 解决方案 > 多层感知器分类器属性

问题描述

我正在使用来自 scikit-learn 的多层感知器分类器在 MNIST 数据集上训练一个神经网络,用于专门对数据集中的数字 0,1 和 7 进行分类。

这是代码片段:

    from sklearn.neural_network import MLPClassifier
    mlp = MLPClassifier(hidden_layer_sizes=4, max_iter=1000, verbose = True, 
                        random_state=211)

在这里,我们如何决定为 hidden_​​layer_sizes 和 max_iter 分配什么值?

我正在尝试使用损失函数来查看我的模型是如何学习的。请看下面:

   import matplotlib.pyplot as plt
   plt.plot(mlp.loss_curve_)
   plt.xlabel('Number of epochs')
   plt.ylabel('loss')
   plt.title('The loss curve for our mlp classifier')
   None

在此处输入图像描述

看上面的情节,我应该推断和理解什么以及我的模型是如何学习的?

然后我得出一个学习性能指标的分类报告:

  from sklearn.metrics import classification_report
  report = classification_report(y_test, y_pred)
  print(report)
          precision    recall  f1-score   support
       0       1.00      1.00      1.00        59
       1       1.00      1.00      1.00        60
       7       1.00      1.00      1.00        59

accuracy                           1.00       178    macro avg       1.00      1.00      1.00       178 weighted avg       1.00      1.00      1.00       178

从上面的分类报告中需要了解什么以及数字0,1和7在上面的报告中是如何分类的?

谢谢!!

标签: deep-learning

解决方案


推荐阅读