GitHub user iyounus opened a pull request:

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

    [SPARK-13777] [ML] Remove constant features from training in noraml solver 
(WLS)

    ## What changes were proposed in this pull request?
    
    "normal" solver in LinearRegression uses Cholesky decomposition to 
calculate the coefficients. If the data has features with identical values 
(zero variance), then (A^T A) matrix is not positive definite any more and the 
Cholesky decomposition fails.
    
    Since A^T.A and features variances are calculated in single pass, it's 
better to modify ATA instead to re-calculating it from the data after dropping 
constant columns. In this PR, I'm dropping columns and rows from ATA 
corresponding to features with zero variance. Then the cholesky decomposition 
can be performed without any problem.
    
    ## How was this patch tested?
    
    A unit test under LineatReagessionSuite is added which compares results 
from this change and l-bgfs solver to glmnet. All these are now onsistent. 


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

    $ git pull https://github.com/iyounus/spark 
SPARK-13777_WLS_fix_for_constant_features

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

    https://github.com/apache/spark/pull/11610.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 #11610
    
----
commit 9412ef439d523e58e5d6b8294628c2196f6f9019
Author: Imran Younus <iyou...@us.ibm.com>
Date:   2016-03-09T19:38:12Z

    remove constant features from training in noraml solver

----


---
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