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?










share|improve this question




























    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?










    share|improve this question


























      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?










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 16 at 21:24

























      asked Nov 16 at 21:13









      user1717931

      95031525




      95031525





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          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






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

          Alcedinidae

          Origin of the phrase “under your belt”?