Skip to content

Instantly share code, notes, and snippets.

@jay-johnson
Last active February 19, 2017 19:10
Show Gist options
  • Save jay-johnson/65b4fb1f798785934ee23bc6f137f7cc to your computer and use it in GitHub Desktop.
Save jay-johnson/65b4fb1f798785934ee23bc6f137f7cc to your computer and use it in GitHub Desktop.
Using XGBoost with the Sci-pype API

Extending the sklearn XGBoost API parameters

http://xgboost.readthedocs.io/en/latest/python/python_api.html#module-xgboost.sklearn

ml_request = {
        "MLAlgo" : {
          "Train"     :{
            "LearningRate"          : 0.1,
            "NumEstimators"         : 1000,
            "Objective"             : "reg:linear",
            "MaxDepth"              : 6,
            "MaxDeltaStep"          : 0,
            "MinChildWeight"        : 1,
            "Gamma"                 : 0,
            "SubSample"             : 0.8,
            "ColSampleByTree"       : 0.8,
            "ColSampleByLevel"      : 1.0,
            "RegAlpha"              : 0,
            "RegLambda"             : 1,
            "BaseScore"             : 0.5,
            "NumThreads"            : -1, # infinite = -1
            "ScaledPositionWeight"  : 1,
            "Seed"                  : 27,
            "Debug"                 : False
          }
       }
    }

Which are used to create an XGBRegressor object in the pycore.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment