spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sourabh <>
Subject MLLIB model export: PMML vs MLLIB serialization
Date Thu, 04 Dec 2014 06:11:19 GMT
Hi All,
I am doing model training using Spark MLLIB inside our hadoop cluster. But
prediction happens in a different realtime synchronous system(Web
application). I am currently exploring different options to export the
trained Mllib models from spark.

   1. *Export model as PMML:* I found the projects under  JPMML: Java PMML
API <>   is quite interesting. Use  JPMML
<>   to convert the mllib model entity to
PMML. And use  PMML evaluator <>  
for prediction in a different system. Or we can also explore  openscoring
rest api <>   for model deployment and

This could be standard approach if we need to port models across different
systems. But converting non linear Mllib models to PMML might be a complex
task. Apart from that I need to keep on updating my Mllib to PMML conversion
code for any new Mllib models or any change in Mllib entities.
I have not evaluated any of these JPMML projects personally and I see there
is only single contributor for these projects. Just wondering if enough
people have already started using these projects. Please share if any of you
have any points on this.

   2. *Export MLLIB model as serialized form:* Mllib models can be
serialized using  Kryo serialization
or normal  java serialization

. And the same model can be deserialized by different other standalone
applications and use the mllib entity for prediction.  This blog
shows an example how spark mllib can be used inside Play web application. I
am expecting, I can use spark mllib in any other JVM based web application
in the same way(?). Please share if any one has any experience on this.
  Advantage of this approach is :
     -> No recurring effort to support any new model or any change in Mllib
model entity in future version.
     -> Less dependency on any other tools
     -> Model can not be ported to non JVM system
     -> Model serialized using one version of Mllib entity, may not be
deserializable using a different version of mllib entity(?).

I think this is a quite common problem.I am really interested to hear from
you people how you are solving this and what are the approaches and pros and


View this message in context:
Sent from the Apache Spark User List mailing list archive at

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

View raw message