Hi,

Assuming that I have run the following pipeline and have got the best logistic 
regression model. How can I then save that model for later use? The following 
command throws an error:

cvModel.bestModel.save("/my/path")

Also, is it possible to get the error (a collection of) for each combination of 
parameters?

I am using spark 1.6.2

import org.apache.spark.ml.Pipeline
import org.apache.spark.ml.classification.LogisticRegression
import org.apache.spark.ml.evaluation.BinaryClassificationEvaluator
import org.apache.spark.ml.tuning.{ParamGridBuilder , CrossValidator}

val lr = new LogisticRegression()

val pipeline = new Pipeline().
    setStages(Array(lr))

val paramGrid = new ParamGridBuilder().
    addGrid(lr.elasticNetParam , Array(0.1)).
    addGrid(lr.maxIter , Array(10)).
    addGrid(lr.regParam , Array(0.1)).
    build()

val cv = new CrossValidator().
    setEstimator(pipeline).
    setEvaluator(new BinaryClassificationEvaluator).
    setEstimatorParamMaps(paramGrid).
    setNumFolds(2)

val cvModel = cv.
    fit(training)


---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscr...@spark.apache.org

Reply via email to