0

我正在尝试使用 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'
4

1 回答 1

1

该教程有点过时,如果您键入clf.classifiers_它应该可以工作。

于 2020-07-22T16:12:33.423 回答