will Park
will Park

Reputation: 73

how to set multi classes with machine learning algorithm?

I'm using XGboost, Randomforest(sklearn), SVM(sklearn) and MLPclassifier(sklearn) as classifier. And I want to set these models for multi label class. How can i set?

import xgboost as xgb
from sklearn.svm import SVC
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import RandomForestClassifier

xgb.XGBClassifier()
SVC()
MLPClassifier()
RandomForestClassifier()

Upvotes: 0

Views: 159

Answers (2)

Vikika
Vikika

Reputation: 318

I think you don't need to do anything extra for XGboost, Random forest and and MLP. For SVC you can use OneVsRestClassifier(LinearSVC()).Then You just have to train with the algorithms you mentioned and tune it based on predictors to get the best results

Upvotes: 0

yatu
yatu

Reputation: 88236

None of these algorithms you've mentioned are restricted to binary classification problems. They can be used for multiclassification problems the same way as you would do for binary classification, by calling model.fit(x_train,y_train).

Upvotes: 1

Related Questions