Hi,
We use such kind of logic for training our model
val model = new LogisticRegressionWithLBFGS()
.setNumClasses(3)
.run(train)
Next, during spark streaming, we load model and apply incoming data to this
model to get specific class, for example:
model.predict(Vectors.dense(10, 590, 190, 700))
How we could achieve the same logic for OneVsRest classification:
val classifier = new LogisticRegression()
.setMaxIter(10)
.setTol(1E-6)
.setFitIntercept(true)
val ovr = new OneVsRest().setClassifier(classifier)
val model = ovr.fit(train)
How call "predict" for this model with vector Vectors.dense(10, 590, 190,
700) and get class ?
We try play with this:
val df = spark.createDataFrame(Array((10, 590, 190, 700)))
val pr_class = model.transform(df)
but get error.
Thank you.
--
View this message in context:
http://apache-spark-user-list.1001560.n3.nabble.com/Equivalent-of-predict-function-from-LogisticRegressionWithLBFGS-in-OneVsRest-with-LogisticRegression-tp27611.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe e-mail: [email protected]