spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert ManyĆ  <>
Subject Serialize mllib's MatrixFactorizationModel
Date Mon, 15 Dec 2014 16:33:36 GMT
Hi all.

I'm willing to serialize and later load a model trained using mllib's

I've tried usign Java serialization with something like:

    val model = ALS.trainImplicit(training, rank, numIter, lambda, 1)
    val fos = new FileOutputStream("model.bin")
    val oos = new ObjectOutputStream(fos)

But when I try to deserialize it using:

    val fos = new FileInputStream("model.bin")
    val oos = new ObjectInputStream(fos)
    val model = oos.readObject().asInstanceOf[MatrixFactorizationModel]

 I get the error:

Exception in thread "main" PARSING_ERROR(2)

I've also tried to serialize MatrixFactorizationModel's both RDDs
(products and users) and later create the MatrixFactorizationModel by
hand passing the RDDs by constructor but I get an error cause its

Error:(58, 17) constructor MatrixFactorizationModel in class
MatrixFactorizationModel cannot be accessed in object RecommendALS
    val model = new MatrixFactorizationModel (8, userFeatures,

Any ideas?


  Albert ManyĆ

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message