spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aseem Bansal <asmbans...@gmail.com>
Subject Question about Multinomial LogisticRegression in spark mllib in spark 2.1.0
Date Wed, 01 Feb 2017 11:42:14 GMT
*What I want to do*
I have a trained a ml.classification.LogisticRegressionModel using spark ml
package.

It has 3 features and 3 classes. So the generated model has coefficients in
(3, 3) matrix and intercepts in Vector of length (3) as expected.

Now, I want to take these coefficients and convert this
ml.classification.LogisticRegressionModel model to an instance of
mllib.classification.LogisticRegressionModel model.

*Why I want to do this*
Computational Speed as SPARK-10413 is still in progress and scheduled for
Spark 2.2 which is not yet released.

*Why I think this is possible*
I checked
https://spark.apache.org/docs/latest/mllib-linear-methods.html#logistic-regression
and in that example a multinomial Logistic Regression is trained. So as per
this the class mllib.classification.LogisticRegressionModel can encapsulate
these parameters.

*Problem faced*
The only constructor in mllib.classification.LogisticRegressionModel takes
a single vector as coefficients and single double as intercept but I have a
Matrix of coefficients and Vector of intercepts respectively.

I tried converting matrix to a vector by just taking the values (Guess
work) but got

requirement failed: LogisticRegressionModel.load with numClasses = 3 and
numFeatures = 3 expected weights of length 6 (without intercept) or 8 (with
intercept), but was given weights of length 9

So any ideas?

Mime
View raw message