我想使用end库获得cross-validation
的(内部)训练准确性:PySpark
ML
lr = LogisticRegression()
param_grid = (ParamGridBuilder()
.addGrid(lr.regParam, [0.01, 0.5])
.addGrid(lr.maxIter, [5, 10])
.addGrid(lr.elasticNetParam, [0.01, 0.1])
.build())
evaluator = MulticlassClassificationEvaluator(predictionCol='prediction')
cv = CrossValidator(estimator=lr,
estimatorParamMaps=param_grid,
evaluator=evaluator,
numFolds=5)
model_cv = cv.fit(train)
predictions_lr = model_cv.transform(validation)
predictions = evaluator.evaluate(predictions_lr)
为了获取每个c.v.
文件夹的准确度指标,我尝试过:
print(model_cv.subModels)
但是这个方法的结果是空的(None
)。
我怎么能得到accuracy
每个文件夹的?