我正在使用管道进行特征工程,然后模拟列车验证拆分以进行超参数优化。我想坚持我最好的模型供以后使用。我使用以下代码:
tvs = TrainValidationSplit(estimator=pipeline,
estimatorParamMaps=paramGrid,
evaluator=BinaryClassificationEvaluator(),
trainRatio=0.8)
model = tvs.fit(train) # model is the model with combination of parameters that performed best
model.save('models/logisticregression_best_model')
我收到以下错误:AttributeError:' Pipeline'对象没有属性' _transfer_param_map_to_java'
答案 0 :(得分:0)
我能够解决它更改此代码:
model.save('models/logisticregression_best_model')
到此代码:
model.bestModel.write().overwrite().save('models/logisticregression_best_model')