AttributeError: 'XGBoostClassifier' object has no attribute 'maxBins'

Hi,
I am using

Spark v2.4.0
xgboost4j-spark-0.90.jar
xgboost4j-0.90.jar"
pyspark-xgboost_0.90_261ab52e07bec461c711d209b70428ab481db470.zip

Code Snippets:

from sparkxgb import XGBoostClassifier as xgb_est
from sparkxgb import XGBoostClassificationModel

Define the model

paramMap = { “evalMetric”: ‘auc’,
“numRound”: 5,
“eta”: 0.1,
“minChildWeight”: 5.0,
“maxDepth”: 6,
“subsample”: 0.8,
“numWorkers”: nworkers,
“scalePosWeight”: scale_pos_weight,
“missing”: 0.0,
“maxBins”: 20 }

xgb = xgb_est(**paramMap)
.setFeaturesCol(feature_vector)
.setLabelCol(model_label)

“XGBoostClassifier” does not seem to have “maxBins” attributes. I checked Xgboost (Scala) and it is documented that ‘maxBins’ is available.

It is working fine when i remove ‘maxBins’.
Hope someone can help to advise. Thanks a lot.

Error:
386
–> 387 xgb = xgb_est(**paramMap123)
388 .setFeaturesCol(feature_vector)
389 .setLabelCol(model_label)

/opt/cloudera/parcels/SPARK2/lib/spark2/python/pyspark/init.py in wrapper(self, *args, **kwargs)
108 raise TypeError(“Method %s forces keyword arguments.” % func.name)
109 self._input_kwargs = kwargs
–> 110 return func(self, **kwargs)
111 return wrapper
112

/tmp/spark-b92f0cf2-7786-436e-b1fd-5b63b31902f9/userFiles-3038666e-75ae-47df-a3e7-575cb1d62a8c/pyspark-xgboost_0.90_261ab52e07bec461c711d209b70428ab481db470.zip/sparkxgb/xgboost.py in init(self, alpha, baseMarginCol, baseScore, cacheTrainingSet, checkpointInterval, checkpointPath, colsampleBylevel, colsampleBytree, contribPredictionCol, eta, evalMetric, featuresCol, gamma, growPolicy, interactionConstraints, labelCol, lambda_, lambdaBias, leafPredictionCol, maxBins, maxDeltaStep, maxDepth, maxLeaves, maximizeEvaluationMetrics, minChildWeight, missing, monotoneConstraints, normalizeType, nthread, numClass, numEarlyStoppingRounds, numRound, numWorkers, objective, objectiveType, predictionCol, probabilityCol, rateDrop, rawPredictionCol, sampleType, scalePosWeight, seed, silent, sketchEps, skipDrop, subsample, thresholds, timeoutRequestWorkers, trainTestRatio, treeLimit, treeMethod, useExternalMemory, verbosity, weightCol)
87 if “reg_lambda” in kwargs:
88 kwargs[“lambda”] = kwargs.pop(“reg_lambda”)
—> 89 self.setParams(**kwargs)
90
91 @keyword_only

/opt/cloudera/parcels/SPARK2/lib/spark2/python/pyspark/init.py in wrapper(self, *args, **kwargs)
108 raise TypeError(“Method %s forces keyword arguments.” % func.name)
109 self._input_kwargs = kwargs
–> 110 return func(self, **kwargs)
111 return wrapper
112

/tmp/spark-b92f0cf2-7786-436e-b1fd-5b63b31902f9/userFiles-3038666e-75ae-47df-a3e7-575cb1d62a8c/pyspark-xgboost_0.90_261ab52e07bec461c711d209b70428ab481db470.zip/sparkxgb/xgboost.py in setParams(self, alpha, baseMarginCol, baseScore, cacheTrainingSet, checkpointInterval, checkpointPath, colsampleBylevel, colsampleBytree, contribPredictionCol, eta, evalMetric, featuresCol, gamma, growPolicy, interactionConstraints, labelCol, lambda_, lambdaBias, leafPredictionCol, maxBins, maxDeltaStep, maxDepth, maxLeaves, maximizeEvaluationMetrics, minChildWeight, missing, monotoneConstraints, normalizeType, nthread, numClass, numEarlyStoppingRounds, numRound, numWorkers, objective, objectiveType, predictionCol, probabilityCol, rateDrop, rawPredictionCol, sampleType, scalePosWeight, seed, silent, sketchEps, skipDrop, subsample, thresholds, timeoutRequestWorkers, trainTestRatio, treeLimit, treeMethod, useExternalMemory, verbosity, weightCol)
149 weightCol=None):
150 kwargs = self._input_kwargs
–> 151 return self._set(**kwargs)
152
153 def _create_model(self, java_model):

/opt/cloudera/parcels/SPARK2/lib/spark2/python/pyspark/ml/param/init.py in _set(self, **kwargs)
434 “”"
435 for param, value in kwargs.items():
–> 436 p = getattr(self, param)
437 if value is not None:
438 try:

AttributeError: ‘XGBoostClassifier’ object has no attribute ‘maxBins’

Regards
Dave

How can i close this thread? Thanks