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

DB Tsai commented on SPARK-7888:
--------------------------------

Last night, I figured out how to do this. If you look at the comment from line 
237,
https://github.com/apache/spark/blob/master/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala

The means from features are removed before training (of course, removing the 
means will densify the vector which is not good, so we have equivalent 
formula), and then we fit a linear regression on the centralized data without 
intercept. When we interpret the model,  since it's trained in the centralized 
data, the intercept is not required of course. However, in the original 
problem, this centralization can be translated into intercept. As a result, we 
can compute the intercept using closed form in line 183. You may want to draw 
couple pictures to help you visualize this.

Back to the topic of disabling intercept, you can think this as training the 
model without `centralization` so the line will cross the origin. 

> Be able to disable intercept in Linear Regression in ML package
> ---------------------------------------------------------------
>
>                 Key: SPARK-7888
>                 URL: https://issues.apache.org/jira/browse/SPARK-7888
>             Project: Spark
>          Issue Type: New Feature
>          Components: ML
>            Reporter: DB Tsai
>            Assignee: holdenk
>




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