【发布时间】:2018-12-16 06:18:30
【问题描述】:
我用 pySpark 训练了一个随机森林。我想要一个带有结果的csv,网格中的每个点。 我的代码是:
estimator = RandomForestRegressor()
evaluator = RegressionEvaluator()
paramGrid = ParamGridBuilder().addGrid(estimator.numTrees, [2,3])\
.addGrid(estimator.maxDepth, [2,3])\
.addGrid(estimator.impurity, ['variance'])\
.addGrid(estimator.featureSubsetStrategy, ['sqrt'])\
.build()
pipeline = Pipeline(stages=[estimator])
crossval = CrossValidator(estimator=pipeline,
estimatorParamMaps=paramGrid,
evaluator=evaluator,
numFolds=3)
cvModel = crossval.fit(result)
所以我想要一个 csv:
numTrees | maxDepth | impurityMeasure
2 2 0.001
2 3 0.00023
等等
最好的方法是什么?
【问题讨论】:
标签: python apache-spark pyspark apache-spark-ml