简体   繁体   English

AttributeError: 'BinaryRelevance' object 没有属性 'classifiers'

[英]AttributeError: 'BinaryRelevance' object has no attribute 'classifiers'

I'm trying to classify datas (emotions) using BinaryRelevance and SVC.我正在尝试使用 BinaryRelevance 和 SVC 对数据(情绪)进行分类。 This code is in这段代码在

http://scikit.ml/tutorial.html 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

and I have this problem我有这个问题

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

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

The tutorial is a bit outdated, if you type clf.classifiers_ instead it should work.该教程有点过时,如果您键入clf.classifiers_而不是它应该可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM