spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yaroslav <>
Subject Equivalent of "predict" function from LogisticRegressionWithLBFGS in OneVsRest with LogisticRegression classifier (Spark 2.0)
Date Sun, 28 Aug 2016 09:06:24 GMT

We use such kind of logic for training our model

    val model = new LogisticRegressionWithLBFGS()

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()

    val ovr = new OneVsRest().setClassifier(classifier)
    val model =

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:
Sent from the Apache Spark User List mailing list archive at

To unsubscribe e-mail:

View raw message