spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sameer Tilak <>
Subject MLLib: Saving and loading a model
Date Mon, 15 Dec 2014 22:21:47 GMT
Hi All,Resending this:
I am using LinearRegressionWithSGD and then I save the model weights and intercept. File that
contains weights have this format:
Intercept is 0 since I am using train not setting the intercept so it can be ignored for the
moment. I would now like to initialize a new model object and using these saved weights from
the above file. We are using CDH 5.1
Something along these lines:
val weights = sc.textFile("linear-weights");val model = new LinearRegressionWithSGD(weights);
then use is as:
val valuesAndPreds = { point =>  val prediction = model.predict(point.features)
 (point.label, prediction)}

Any pointers to how do I do that?
View raw message