spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sameer Tilak <>
Subject MLLib: loading saved model
Date Wed, 03 Dec 2014 18:12:25 GMT
Hi All,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