Re: How to save mllib model to hdfs and reload it

2014-08-14 Thread lancezhange
exceptions. Sent while mobile. Pls excuse typos etc. On Aug 13, 2014 7:03 AM, lancezhange [hidden email] http://user/SendEmail.jtp?type=nodenode=12112i=3 wrote: my prediction codes are simple enough as follows: *val labelsAndPredsOnGoodData = goodDataPoints.map { point = val prediction

Re: How to save mllib model to hdfs and reload it

2014-08-14 Thread lancezhange
I finally solved the problem by following code var m: org.apache.spark.mllib.classification.LogisticRegressionModel = null m = newModel // newModel is the loaded one, see above post of mine val labelsAndPredsOnGoodData = goodDataPoints.map { point = val prediction =

Re: How to save mllib model to hdfs and reload it

2014-08-13 Thread lancezhange
let's say you have a model which is of class org.apache.spark.mllib.classification.LogisticRegressionModel you can save model to disk as following: /import java.io.FileOutputStream import java.io.ObjectOutputStream val fos = new FileOutputStream(e:/model.obj) val oos = new

Re: How to save mllib model to hdfs and reload it

2014-08-13 Thread lancezhange
my prediction codes are simple enough as follows: *val labelsAndPredsOnGoodData = goodDataPoints.map { point = val prediction = model.predict(point.features) (point.label, prediction) }* when model is the loaded one, above code just can't work. Can you catch the error? Thanks. PS. i use