Github user BryanCutler commented on the issue:
https://github.com/apache/spark/pull/17306
Thanks @leifker for the PR, this is a good idea. I think though it can
already be accomplished with the current param grid builder. Since the stages
of a pipeline are actually a param, you can add these to the param grid and
will evaluate the different pipelines, also reusing the cached splits in
cross-val. I tried this out by modifying the example
`ModelSelectionViaCrossValidation` and it seems to work
```scala
val tokenizer = new Tokenizer()
.setInputCol("text")
.setOutputCol("words")
val hashingTF = new HashingTF()
.setInputCol(tokenizer.getOutputCol)
.setOutputCol("features")
val lr = new LogisticRegression()
.setMaxIter(10)
val dt = new DecisionTreeClassifier()
.setMaxDepth(5)
val pipeline = new Pipeline()
val pipeline1: Array[PipelineStage] = Array(tokenizer, hashingTF, lr)
val pipeline2: Array[PipelineStage] = Array(tokenizer, hashingTF, dt)
val paramGrid = new ParamGridBuilder()
.addGrid[Array[PipelineStage]](pipeline.stages, Array(pipeline1,
pipeline2))
.addGrid(hashingTF.numFeatures, Array(10, 100, 1000))
.addGrid(lr.regParam, Array(0.1, 0.01))
.build()
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]