我正在学习如何使用Spark DataFrames API在scala中构建机器学习模型,并想知道可以用于优化模型的所有超参数的列表。通过搜索到目前为止,我找到了一些LinearRegression的超参数,例如:
它可以以下列方式使用:
import org.apache.spark.ml.regression.LinearRegression
val lr = new LinearRegression().setMaxIter(100).setRegParam(0.3).setElasticNetParam(0.8)
val lrModel = lr.fit(training)在星火中是否有一个文档页面或方法可以列出所有可调的超参数?类似于:
LinearRegression.getParamList()
RandomForest.getParamList()发布于 2017-05-21 13:12:35
检查毫升调谐,利用ML-Pipelines将您选择的特性通过ParamGridBuilder传递给CrossValidator,并运行管道来估计哪些集合的性能最好,下面的示例如下:
val lr = new LinearRegression()
.setMaxIter(10)
val paramGrid = new ParamGridBuilder()
.addGrid(lr.regParam, Array(0.1, 0.01))
.addGrid(lr.fitIntercept)
.addGrid(lr.elasticNetParam, Array(0.0, 0.5, 1.0))
.build()
val trainValidationSplit = new TrainValidationSplit()
.setEstimator(lr)
.setEvaluator(new RegressionEvaluator)
.setEstimatorParamMaps(paramGrid)
.setTrainRatio(0.8)
val model = trainValidationSplit.fit(training)更进一步,您可以探索scala文档ml.param,有一个方法explainParam(),但我还没有使用它api/scala/管道。
https://stackoverflow.com/questions/44096823
复制相似问题