Я пытаюсь настроить модель случайного леса, используя pyspark, CrossValidator и BinaryClassificationEvaluator, CrossValidator, но при этом я получаю сообщение об ошибке. Вот мой код.
from pyspark.ml.evaluation import BinaryClassificationEvaluator
from pyspark.ml.classification import RandomForestClassifier
from pyspark.ml.feature import VectorAssembler
from pyspark.ml import Pipeline
# Create a spark RandomForestClassifier using all default parameters.
# Create a training, and testing df
training_df, testing_df = raw_data_df.randomSplit([0.6, 0.4])
# build a pipeline for analysis
va = VectorAssembler().setInputCols(training_df.columns[0:110:]).setOutputCol('features')
# featuresCol="features"
rf = RandomForestClassifier(labelCol="quality")
# Train the model and calculate the AUC using a BinaryClassificationEvaluator
rf_pipeline = Pipeline(stages=[va, rf]).fit(training_df)
bce = BinaryClassificationEvaluator(labelCol="quality")
# Check AUC before tuning
bce.evaluate(rf_pipeline.transform(testing_df))
from pyspark.ml.tuning import CrossValidator, ParamGridBuilder
paramGrid = ParamGridBuilder().build()
crossValidator = CrossValidator(estimator=rf_pipeline,
estimatorParamMaps=paramGrid,
evaluator=bce,
numFolds=3)
model = crossValidator.fit(training_df)
Выдает эту ошибку:
AttributeError: 'PipelineModel' object has no attribute 'fitMultiple'
Как мне исправить эту проблему?