As per the scikit multiclass classification Logistic regression can be used for multi-class classification by setting multi_class=multinomial in the the constructor. But doing this gives error:
Code:
text_clf = Pipeline([('vect', TfidfVectorizer()),('clf', LogisticRegression(multi_class = 'multinomial')),])
text_clf = text_clf.fit(X_train, Y_train)
Error:
ValueError: Solver liblinear does not support a multinomial backend.
Can you tell me what is wrong here?
Note: Keeping multi_class to blank i.e. "ovr" is working fine but it fits a binary model for each classifier and I want to try mutlinomial feature also.
From the doc:
Currently the ‘multinomial’ option is supported only by the ‘lbfgs’ and ‘newton-cg’ solvers.
So you need to explicitly set solver
to 'newton-cg
' or 'lbfgs'
, since the default solver is 'liblinear'
.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加