Search code examples
pythonpandasmachine-learningxgboost

How to use key word lambda as a parameter in XGBoost in Python?


I try to train XGBoost machine learning model in Python and I am wondering how to use parameter "lambda" in this model, because as you are awar "lambda" is a key word for Python.

I have code like:

XGB_4 = xgb.sklearn.XGBClassifier(n_estimators = 500,
                                  lambda = 15)

and error:

    lambda = 15,
           ^
SyntaxError: invalid syntax

How can I use "lambda" as a parameter in Python ?


Solution

  • According to the docs, the Python version of the parameter name is reg_lambda, so instead of lambda=15, use reg_lambda=15.