-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem transformation does not work with XGBoost #88
Comments
Please post your relevant code so that we can see what you're trying to achieve. |
Here is my code I am using- import pandas as pd
import numpy as np
from sklearn.svm import SVC
#from sklearn.multioutput import ClassifierChain
from sklearn.naive_bayes import GaussianNB
from modlamp.sequences import MixedLibrary
from sklearn.model_selection import train_test_split
from skmultilearn.problem_transform import BinaryRelevance, LabelPowerset, ClassifierChain
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier, GradientBoostingClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.metrics import f1_score
import xgboost as xgb
from mlxtend.classifier import StackingClassifier
data = pd.read_csv("full_dataset.csv")
y = data[['antiviral','antifungal','antibacterial']]
to_drop = ['# ID','Sequence','antiviral', 'antibacterial', 'antifungal']
X = data.drop(to_drop,axis=1)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.1)
clf = LabelPowerset(xgb.XGBClassifier(n_estimators=500))
clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
print(y_pred)
print("The macro averaged F1-score is: %.3f" %(f1_score(y_pred, y_test, average='macro'))) On running the program, the output shown is this-
|
The same error is obtained when using |
I think it's a problem on your side, something with your data. The following proof of concept runs flawlessly:
Can you report back if this works for you? |
Hello, I checked the execution of the program and problem transformation works fine if GaussianNB or other classifiers are used. It just doesn't work for XGBoost. The dataset is available here for reference- https://goo.gl/ivJDsw |
I checked your data, the error seems to be related to the one mentioned here: dmlc/xgboost#1238
So XGBoost is at fault, not scikit-multilearn from what I can gather ;) If this issue is resolved I'd like to close it afterwards. |
I am facing a problem using XGBoost for multi-label classification. Is this an expected behavior?
The text was updated successfully, but these errors were encountered: