You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to involve the L2 regularization parameter into the xgboostregressor by specifying the lambda_ parameter, an error occurred indicating that "TypeError: setParams() got an unexpected keyword argument 'lambda'". Could you help me to fix it? Your kind help is greatly appreciated.
The text was updated successfully, but these errors were encountered:
Try with a trailing underscore, i.e. lambda_. I think this was renamed to avoid the clash with python's lambda reserved keyword.
@sllynn Thank you very much for the advice. Actually, that's what I did to use 'lambda_', i.e., the parameter I used are "model = XGBoostRegressor(objective='reg:squarederror', numRound=100, eta=0.1, maxDepth=5, alpha=0.0, lambda_=1.0)", and then the aforementioned TypeError raised. I guess it is related to the code in the 'init' function of the class 'XGBoostRegressor' in below:
if "lambda_" in kwargs:
kwargs["lambda"] = kwargs.pop("lambda_")
self.setParams(**kwargs)"
In addition, I found that the parameter used for the L2 regularization in xgboost4j_spark is 'lambda' (ref: https://xgboost.readthedocs.io/en/latest/jvm/scaladocs/xgboost4j-spark/ml/dmlc/xgboost4j/scala/spark/XGBoostRegressor.html). The rename process of replacing 'lambda_' with 'lambda' is probably to ensure the parameter consistence with the scala code. Nevertheless, I don't know what I could do to fix it. Do you have any opinions on this? Thank you very much and look forward to your reply.
When I try to involve the L2 regularization parameter into the xgboostregressor by specifying the lambda_ parameter, an error occurred indicating that "TypeError: setParams() got an unexpected keyword argument 'lambda'". Could you help me to fix it? Your kind help is greatly appreciated.
The text was updated successfully, but these errors were encountered: