3
$\begingroup$

I'm trying to understand the difference between xgboost.XGBRegressor and xgboost.sklearn.XGBClassifier.

Can someone explain the difference in a concise manner?

Because when I fit both classifiers with the exact same data, I get pretty different performance.

This is how I fit the data.

clf = xgboost.XGBRegressor(alpha=c)
#clf = xgboost.sklearn.XGBClassifier(alpha=c)

clf.fit(X_train, y_train)
y_pred = clf.predict(X_test)
print('Model roc auc score: %0.3f' % roc_auc_score(y_test, y_pred, average='macro', sample_weight=None))
print('Model pr auc score: %0.3f' % average_precision_score(y_test, y_pred))

when clf = xgboost.sklearn.XGBClassifier(alpha=c)

Model roc auc score: 0.544

Model pr auc score: 0.303

when clf = xgboost.XGBRegressor(alpha=c)

Model roc auc score: 0.703

Model pr auc score: 0.453

What would cause this performance difference?

$\endgroup$
1
  • $\begingroup$ You should use predict_proba for the classifier. This is why the ROC AUC is low. $\endgroup$ Feb 16 at 9:00

1 Answer 1

11
$\begingroup$

XGBRegressor is for continuous target/outcome variables. These are often called "regression problems."

XGBClassifier is for categorical target/outcome variables. These are often called "classification problems."

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.