compare cv score from cross_val_score and xgb.cv
up vote
0
down vote
favorite
I am trying to select a good model, say between Random Forest and XGB. For that, I do this:
- stratified KFold (from model_selection)
- cross_val_score (from model_selection)
- get mean cv score for Random Forest classifier.
For XGB, even though I could do same as above, I want to use xgb.cv and Dtrain matrices - as they claim that is much faster and efficient. So, I did this:
- xgtrain = xgb.Dtrain(X, label=y)
- xgb_cv_results is a dataframe...with appropriate metric (I used 'mlogloss' with 'objective': 'multi:softprob').
Now, since the two cv scoring are different, I am not in a position to compare the scores to select the best model. How can I get similar scoring methods in cross_val_score and xgb.cv ? In other words, is the common scoring mechanism such as 'accuracy' or 'neg_log_loss' in both the cv methods?
Here, the metric is very different from scoring parameter seen in cross_val_score. Here, I am dealing with multi-class classification. And, I need to see soft probabilities ('multi:softprob'). With this option, I cannot use 'auc' as my metric (there is a known bug in XGBoost - for multi-class classification, it does not do proper checking of X and y) and errors out.
Any ideas?
cross-validation xgbclassifier
add a comment |
up vote
0
down vote
favorite
I am trying to select a good model, say between Random Forest and XGB. For that, I do this:
- stratified KFold (from model_selection)
- cross_val_score (from model_selection)
- get mean cv score for Random Forest classifier.
For XGB, even though I could do same as above, I want to use xgb.cv and Dtrain matrices - as they claim that is much faster and efficient. So, I did this:
- xgtrain = xgb.Dtrain(X, label=y)
- xgb_cv_results is a dataframe...with appropriate metric (I used 'mlogloss' with 'objective': 'multi:softprob').
Now, since the two cv scoring are different, I am not in a position to compare the scores to select the best model. How can I get similar scoring methods in cross_val_score and xgb.cv ? In other words, is the common scoring mechanism such as 'accuracy' or 'neg_log_loss' in both the cv methods?
Here, the metric is very different from scoring parameter seen in cross_val_score. Here, I am dealing with multi-class classification. And, I need to see soft probabilities ('multi:softprob'). With this option, I cannot use 'auc' as my metric (there is a known bug in XGBoost - for multi-class classification, it does not do proper checking of X and y) and errors out.
Any ideas?
cross-validation xgbclassifier
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to select a good model, say between Random Forest and XGB. For that, I do this:
- stratified KFold (from model_selection)
- cross_val_score (from model_selection)
- get mean cv score for Random Forest classifier.
For XGB, even though I could do same as above, I want to use xgb.cv and Dtrain matrices - as they claim that is much faster and efficient. So, I did this:
- xgtrain = xgb.Dtrain(X, label=y)
- xgb_cv_results is a dataframe...with appropriate metric (I used 'mlogloss' with 'objective': 'multi:softprob').
Now, since the two cv scoring are different, I am not in a position to compare the scores to select the best model. How can I get similar scoring methods in cross_val_score and xgb.cv ? In other words, is the common scoring mechanism such as 'accuracy' or 'neg_log_loss' in both the cv methods?
Here, the metric is very different from scoring parameter seen in cross_val_score. Here, I am dealing with multi-class classification. And, I need to see soft probabilities ('multi:softprob'). With this option, I cannot use 'auc' as my metric (there is a known bug in XGBoost - for multi-class classification, it does not do proper checking of X and y) and errors out.
Any ideas?
cross-validation xgbclassifier
I am trying to select a good model, say between Random Forest and XGB. For that, I do this:
- stratified KFold (from model_selection)
- cross_val_score (from model_selection)
- get mean cv score for Random Forest classifier.
For XGB, even though I could do same as above, I want to use xgb.cv and Dtrain matrices - as they claim that is much faster and efficient. So, I did this:
- xgtrain = xgb.Dtrain(X, label=y)
- xgb_cv_results is a dataframe...with appropriate metric (I used 'mlogloss' with 'objective': 'multi:softprob').
Now, since the two cv scoring are different, I am not in a position to compare the scores to select the best model. How can I get similar scoring methods in cross_val_score and xgb.cv ? In other words, is the common scoring mechanism such as 'accuracy' or 'neg_log_loss' in both the cv methods?
Here, the metric is very different from scoring parameter seen in cross_val_score. Here, I am dealing with multi-class classification. And, I need to see soft probabilities ('multi:softprob'). With this option, I cannot use 'auc' as my metric (there is a known bug in XGBoost - for multi-class classification, it does not do proper checking of X and y) and errors out.
Any ideas?
cross-validation xgbclassifier
cross-validation xgbclassifier
edited Nov 16 at 21:24
asked Nov 16 at 21:13
user1717931
95031525
95031525
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53345459%2fcompare-cv-score-from-cross-val-score-and-xgb-cv%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown