GitHub user sethah opened a pull request:

    https://github.com/apache/spark/pull/14109

    [SPARK-16404][ML] LeastSquaresAggregators serializes unnecessary data

    ## What changes were proposed in this pull request?
    Similar to `LogisticAggregator`, `LeastSquaresAggregator` used for linear 
regression ends up serializing the coefficients and the features standard 
deviations, which is not necessary and can cause performance issues for high 
dimensional data. This patch removes this serialization.
    
    In https://github.com/apache/spark/pull/13729 the approach was to pass 
these values directly to the add method. The approach used here, initially, is 
to mark these fields as transient instead which gives the benefit of keeping 
the signature of the add method simple and interpretable. The downside is that 
it requires the use of `@transient lazy val`s which are difficult to reason 
about if one is not quite familiar with serialization in Scala/Spark. 
    
    ## How was this patch tested?
    
    **MLlib**
    
![image](https://cloud.githubusercontent.com/assets/7275795/16703660/436f79fa-4524-11e6-9022-ef00058ec718.png)
    
    **ML without patch**
    
![image](https://cloud.githubusercontent.com/assets/7275795/16703831/c4d50b9e-4525-11e6-80cb-9b58c850cd41.png)
    
    
    **ML with patch**
    
![image](https://cloud.githubusercontent.com/assets/7275795/16703675/63e0cf40-4524-11e6-9120-1f512a70e083.png)


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/sethah/spark LIR_serialize

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/14109.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #14109
    
----
commit 6b85765fb37f32e0c7587cd463e387a13ed5abdd
Author: sethah <seth.hendrickso...@gmail.com>
Date:   2016-07-08T18:53:33Z

    remove unnecessary serialization in linear regression

commit 53655486b8ab28aa27077910672d17f3f6b66dd4
Author: sethah <seth.hendrickso...@gmail.com>
Date:   2016-07-08T22:45:07Z

    using transient

commit 53c9192f0a8c234a1d185e3066154861ef25b77f
Author: sethah <seth.hendrickso...@gmail.com>
Date:   2016-07-08T22:52:12Z

    style

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to