【问题标题】:Imbalanced dataset using MLP classifier in python在python中使用MLP分类器的不平衡数据集
【发布时间】:2017-11-20 10:57:03
【问题描述】:

我正在处理不平衡的数据集,并尝试使用 MLP 分类器制作预测模型。不幸的是,该算法将测试集中的所有观察结果分类为“1”类,因此分类报告中的 f1 分数和召回值为 0。有人知道如何处理吗?

model= MLPClassifier(solver='lbfgs', activation='tanh')
model.fit(X_train, y_train)
score=accuracy_score(y_test, model.predict(X_test), )
fpr, tpr, thresholds = roc_curve(y_test, model.predict_proba(X_test)[:,1])
roc=roc_auc_score(y_test, model.predict_proba(X_test)[:,1])
cr=classification_report(y_test, model.predict(X_test))

【问题讨论】:

    标签: python-3.x scikit-learn neural-network


    【解决方案1】:

    处理不平衡数据集的技术很少。 here 提供了一个完全专用的 Python 库“不平衡学习”。但是应该谨慎对待在特定情况下应该使用哪种技术。

    https://svds.com/learning-imbalanced-classes/ 也提供了一些有趣的示例

    【讨论】:

      猜你喜欢
      • 2019-11-05
      • 2018-09-13
      • 2015-01-28
      • 1970-01-01
      • 2017-11-01
      • 2019-09-25
      • 2021-09-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多