aboutsummaryrefslogtreecommitdiff
path: root/R/pkg/R/functions.R
diff options
context:
space:
mode:
authorWeichenXu <WeichenXu123@outlook.com>2017-04-21 17:58:13 +0000
committerDB Tsai <dbtsai@dbtsai.com>2017-04-21 17:58:13 +0000
commiteb00378f0eed6afbf328ae6cd541cc202d14c1f0 (patch)
tree97bc09893183aa42337458606f1431006dfcdba0 /R/pkg/R/functions.R
parenta750a595976791cb8a77063f690ea8f82ea75a8f (diff)
downloadspark-eb00378f0eed6afbf328ae6cd541cc202d14c1f0.tar.gz
spark-eb00378f0eed6afbf328ae6cd541cc202d14c1f0.tar.bz2
spark-eb00378f0eed6afbf328ae6cd541cc202d14c1f0.zip
[SPARK-20423][ML] fix MLOR coeffs centering when reg == 0
## What changes were proposed in this pull request? When reg == 0, MLOR has multiple solutions and we need to centralize the coeffs to get identical result. BUT current implementation centralize the `coefficientMatrix` by the global coeffs means. In fact the `coefficientMatrix` should be centralized on each feature index itself. Because, according to the MLOR probability distribution function, it can be proven easily that: suppose `{ w0, w1, .. w(K-1) }` make up the `coefficientMatrix`, then `{ w0 + c, w1 + c, ... w(K - 1) + c}` will also be the equivalent solution. `c` is an arbitrary vector of `numFeatures` dimension. reference https://core.ac.uk/download/pdf/6287975.pdf So that we need to centralize the `coefficientMatrix` on each feature dimension separately. **We can also confirm this through R library `glmnet`, that MLOR in `glmnet` always generate coefficients result that the sum of each dimension is all `zero`, when reg == 0.** ## How was this patch tested? Tests added. Author: WeichenXu <WeichenXu123@outlook.com> Closes #17706 from WeichenXu123/mlor_center.
Diffstat (limited to 'R/pkg/R/functions.R')
0 files changed, 0 insertions, 0 deletions