You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Yanbo Liang (JIRA)" <ji...@apache.org> on 2016/10/08 06:45:20 UTC
[jira] [Updated] (SPARK-17835) Optimize NaiveBayes mllib wrapper to
eliminate extra pass on data
[ https://issues.apache.org/jira/browse/SPARK-17835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Yanbo Liang updated SPARK-17835:
--------------------------------
Description:
SPARK-14077 copied the {{NaiveBayes}} implementation from mllib to ml and left ml as a wrapper. However, there are some difference between mllib and ml to handle {{labels}}:
* mllib allow input labels as {-1, +1}, however, ml assumes the input labels in range [0, numClasses).
* mllib {{NaiveBayesModel}} expose {{labels}} but ml did not due to the assumption mention above.
During the copy in SPARK-14077, we use {{val labels = data.map(_.label).distinct().collect().sorted}} to get the distinct labels firstly, and then feed to training. It inovlves another extra Spark job compared with the original implementation. Since {{NaiveBayes}} only do one aggregation during training, add another one seems not efficient. We can get the labels in a single pass along with {{NaiveBayes}} training and send them to MLlib side.
was:
SPARK-14077 copied the {{NaiveBayes}} implementation from mllib to ml and left ml as a wrapper. However, there are some difference between mllib and ml to handle {{labels}}:
* mllib allow input labels as {-1, +1}, however, ml assumes the input labels in range [0, numClasses).
* mllib {{NaiveBayesModel}} expose {{labels}} but ml did not due to the assumption mention above.
During the copy in SPARK-14077, we use {{val labels = data.map(_.label).distinct().collect().sorted}} to get the distinct labels firstly, and then feed to training. It inovlves another extra Spark job compared with the original implementation. Since {{NaiveBayes}} only do one aggregation during training, add another one seems not efficient. We can get the labels in a single pass along with {{NaiveBayes}} training and send them to MLlib side.
> Optimize NaiveBayes mllib wrapper to eliminate extra pass on data
> -----------------------------------------------------------------
>
> Key: SPARK-17835
> URL: https://issues.apache.org/jira/browse/SPARK-17835
> Project: Spark
> Issue Type: Improvement
> Components: ML, MLlib
> Reporter: Yanbo Liang
>
> SPARK-14077 copied the {{NaiveBayes}} implementation from mllib to ml and left ml as a wrapper. However, there are some difference between mllib and ml to handle {{labels}}:
> * mllib allow input labels as {-1, +1}, however, ml assumes the input labels in range [0, numClasses).
> * mllib {{NaiveBayesModel}} expose {{labels}} but ml did not due to the assumption mention above.
> During the copy in SPARK-14077, we use {{val labels = data.map(_.label).distinct().collect().sorted}} to get the distinct labels firstly, and then feed to training. It inovlves another extra Spark job compared with the original implementation. Since {{NaiveBayes}} only do one aggregation during training, add another one seems not efficient. We can get the labels in a single pass along with {{NaiveBayes}} training and send them to MLlib side.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org