flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Theodore Vasiloudis <theodoros.vasilou...@gmail.com>
Subject Re: Extracting weights from linear regression model
Date Thu, 08 Oct 2015 12:48:05 GMT
Hello Trevor,

I assume you using the MultipleLinearRegression class in a manner similar
to our examples, i.e.:

// Create multiple linear regression learnerval mlr =
// Obtain training and testing data setval trainingDS:
DataSet[LabeledVector] = ...val testingDS: DataSet[Vector] = ...
// Fit the linear model to the provided datamlr.fit(trainingDS)

After you've run the fit method, you can get the weights by calling:

val WeightVector(weights, intercept) = mlr.weightsOption.get.collect().head

weights should be a flink.ml.math.DenseVector object and the intercept a Double.



On Wed, Oct 7, 2015 at 10:52 PM, Trevor Grant <trevor.d.grant@gmail.com>

> Sorry if this is a novice question, but I can't figure out how to extract
> the weights vector from a multiple linear regression model.  I can
> fit/predict, but I can't get the weight vector.
> Any advice would be appreciated (even snide go read the docs comments, so
> long as they point me to applicable docs, because I've been struggling with
> this all day).
> Thanks!
> tg
> Trevor Grant
> Data Scientist
> https://github.com/rawkintrevo
> http://stackexchange.com/users/3002022/rawkintrevo
> *"Fortunate is he, who is able to know the causes of things."  -Virgil*

View raw message