Created
April 20, 2019 03:45
-
-
Save gabrielziegler3/258e54489699445a9309cdcb1eb0345e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# META CODE | |
from sklearn.multiclass import OneVsRestClassifier | |
from xgboost import XGBClassifier | |
from sklearn.preprocessing import MultiLabelBinarizer | |
clf = OneVsRestClassifier(XGBClassifier(n_jobs=-1, max_depth=4)) | |
# You may need to use MultiLabelBinarizer to encode your variables from arrays [[x, y, z]] to a multilabel | |
# format before training. | |
mlb = MultiLabelBinarizer() | |
y = mlb.fit_transform(y) | |
clf.fit(X, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment