Repository: spark
Updated Branches:
  refs/heads/branch-1.6 f6e0c1737 -> 4ff9892f6


[MINOR][ML] Fix some mistake in LinearRegression formula.

## What changes were proposed in this pull request?
Fix some mistake in ```LinearRegression``` formula.

## How was this patch tested?
Documents change, no tests.

Author: Yanbo Liang <yblia...@gmail.com>

Closes #14369 from yanboliang/LiR-formula.

(cherry picked from commit 3c3371bbd6361011b138cce88f6396a2aa4e2cb9)
Signed-off-by: Sean Owen <so...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/4ff9892f
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/4ff9892f
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/4ff9892f

Branch: refs/heads/branch-1.6
Commit: 4ff9892f61b75def8e9082d954dfcebf7e91a8e3
Parents: f6e0c17
Author: Yanbo Liang <yblia...@gmail.com>
Authored: Wed Jul 27 11:24:28 2016 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Wed Jul 27 11:24:58 2016 +0100

----------------------------------------------------------------------
 .../org/apache/spark/ml/regression/LinearRegression.scala      | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/4ff9892f/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
----------------------------------------------------------------------
diff --git 
a/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala 
b/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
index 5e58509..f308d8b 100644
--- a/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
+++ b/mllib/src/main/scala/org/apache/spark/ml/regression/LinearRegression.scala
@@ -735,16 +735,16 @@ class LinearRegressionSummary private[regression] (
  * {{{
  * \frac{\partial L}{\partial\w_i} =
  *     1/N \sum_j diff_j (x_{ij} - \bar{x_i}) / \hat{x_i}
- *   = 1/N ((\sum_j diff_j x_{ij} / \hat{x_i}) - diffSum \bar{x_i}) / 
\hat{x_i})
+ *   = 1/N ((\sum_j diff_j x_{ij} / \hat{x_i}) - diffSum \bar{x_i} / \hat{x_i})
  *   = 1/N ((\sum_j diff_j x_{ij} / \hat{x_i}) + correction_i)
  * }}},
- * where correction_i = - diffSum \bar{x_i}) / \hat{x_i}
+ * where correction_i = - diffSum \bar{x_i} / \hat{x_i}
  *
  * A simple math can show that diffSum is actually zero, so we don't even
  * need to add the correction terms in the end. From the definition of diff,
  * {{{
  * diffSum = \sum_j (\sum_i w_i(x_{ij} - \bar{x_i}) / \hat{x_i} - (y_j - 
\bar{y}) / \hat{y})
- *         = N * (\sum_i w_i(\bar{x_i} - \bar{x_i}) / \hat{x_i} - (\bar{y_j} - 
\bar{y}) / \hat{y})
+ *         = N * (\sum_i w_i(\bar{x_i} - \bar{x_i}) / \hat{x_i} - (\bar{y} - 
\bar{y}) / \hat{y})
  *         = 0
  * }}}
  *


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

Reply via email to