[ 
https://issues.apache.org/jira/browse/SPARK-5981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14338936#comment-14338936
 ] 

Joseph K. Bradley commented on SPARK-5981:
------------------------------------------

You can, but I'm going to split it into sub-tasks since it will require storing 
the model within Python (simple for some models like Naive Bayes but complex 
for others like trees).  We can do one sub-task at a time.

Also, we'll have to see if there is a performance hit.  I've been wondering 
which is faster:
* store the model in Scala and do batch prediction on an RDD
* store the model in Python and do prediction on an RDD using map + 
single-instance predict within the map

> pyspark ML models should support predict/transform on vector within map
> -----------------------------------------------------------------------
>
>                 Key: SPARK-5981
>                 URL: https://issues.apache.org/jira/browse/SPARK-5981
>             Project: Spark
>          Issue Type: Improvement
>          Components: MLlib, PySpark
>    Affects Versions: 1.3.0
>            Reporter: Joseph K. Bradley
>
> Currently, most Python models only have limited support for single-vector 
> prediction.
> E.g., one can call {code}model.predict(myFeatureVector){code} for a single 
> instance, but that fails within a map for Python ML models and transformers 
> which use JavaModelWrapper:
> {code}
> data.map(lambda features: model.predict(features))
> {code}
> This fails because JavaModelWrapper.call uses the SparkContext (within the 
> transformation).  (It works for linear models, which do prediction within 
> Python.)
> Supporting prediction within a map would require storing the model and doing 
> prediction/transformation within Python.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to