Repository: mahout
Updated Branches:
  refs/heads/master d848625df -> 4e0106ae5


MAHOUT-1926 Fix p value calc closes apache/mahout#288


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

Branch: refs/heads/master
Commit: 4e0106ae5edafbef7b1411d66bc5f9e9bf44045a
Parents: d848625
Author: rawkintrevo <[email protected]>
Authored: Sun Feb 26 22:56:54 2017 -0600
Committer: rawkintrevo <[email protected]>
Committed: Sun Feb 26 22:56:54 2017 -0600

----------------------------------------------------------------------
 .../mahout/math/algorithms/regression/LinearRegressorModel.scala   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mahout/blob/4e0106ae/math-scala/src/main/scala/org/apache/mahout/math/algorithms/regression/LinearRegressorModel.scala
----------------------------------------------------------------------
diff --git 
a/math-scala/src/main/scala/org/apache/mahout/math/algorithms/regression/LinearRegressorModel.scala
 
b/math-scala/src/main/scala/org/apache/mahout/math/algorithms/regression/LinearRegressorModel.scala
index 2583795..84f50ed 100644
--- 
a/math-scala/src/main/scala/org/apache/mahout/math/algorithms/regression/LinearRegressorModel.scala
+++ 
b/math-scala/src/main/scala/org/apache/mahout/math/algorithms/regression/LinearRegressorModel.scala
@@ -71,7 +71,7 @@ trait LinearRegressorFitter[K] extends RegressorFitter[K] {
     val se = varCovarMatrix.viewDiagonal.assign(SQRT)
     val tScore = model.beta / se
     val tDist = new org.apache.commons.math3.distribution.TDistribution(n-k)
-    val pval = dvec(tScore.toArray.map(t => 2 * (1.0 - 
tDist.cumulativeProbability(t)) ))
+    val pval = dvec(tScore.toArray.map(t => 2 * (1.0 - 
tDist.cumulativeProbability(Math.abs(t))) ))
     // ^^ TODO bug in this calculation- fix and add test
     //degreesFreedom = k
 

Reply via email to