【问题标题】:AttributeError: 'BinaryRelevance' object has no attribute 'classifiers'AttributeError:“BinaryRelevance”对象没有属性“分类器”
【发布时间】:2020-02-12 05:25:16
【问题描述】:

我正在尝试使用 BinaryRelevance 和 SVC 对数据(情绪)进行分类。这段代码在

http://scikit.ml/tutorial.html

from skmultilearn.dataset import load_dataset
X_train, y_train, feature_names, label_names = load_dataset('emotions', 'train')
X_test, y_test, _, _ = load_dataset('emotions', 'test')
from skmultilearn.problem_transform import BinaryRelevance
from sklearn.svm import SVC
clf = BinaryRelevance(
    classifier=SVC(),
    require_dense=[False, True]
)
clf.fit(X_train, y_train)
clf.classifiers

我有这个问题

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-11-5aa82f5c3cc2> in <module>()
----> 1 clf.classifiers

AttributeError: 'BinaryRelevance' object has no attribute 'classifiers'

【问题讨论】:

    标签: python scikit-multilearn


    【解决方案1】:

    教程有点过时了,如果你输入 clf.classifiers_ 代替它应该可以工作。

    【讨论】:

      猜你喜欢
      • 2020-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-16
      • 1970-01-01
      • 2020-09-28
      • 1970-01-01
      • 2012-12-01
      相关资源
      最近更新 更多