[
https://issues.apache.org/jira/browse/MAHOUT-1962?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15995555#comment-15995555
]
ASF GitHub Bot commented on MAHOUT-1962:
----------------------------------------
Github user rawkintrevo commented on a diff in the pull request:
https://github.com/apache/mahout/pull/300#discussion_r114640575
--- Diff:
math-scala/src/main/scala/org/apache/mahout/math/algorithms/regression/tests/FittnessTests.scala
---
@@ -47,10 +52,44 @@ object FittnessTests {
// https://en.wikipedia.org/wiki/Mean_squared_error
def MeanSquareError[R[K] <: RegressorModel[K], K](model: R[K],
residuals: DrmLike[K]): R[K] = {
+ // TODO : I think mse denom should be (row - col) ??
val mse = residuals.assign(SQUARE).sum / residuals.nrow
model.mse = mse
model.testResults += ('mse -> mse)
model.summary += s"\nMean Squared Error: ${mse}"
model
}
+
+ // https://en.wikipedia.org/wiki/xxxx
+ def FTest[R[K] <: RegressorModel[K], K](model: R[K], drmFeatures:
DrmLike[K], drmTarget: DrmLike[K]): R[K] = {
+
+ // This is the residual sum of squares for just the intercept
+ //println(" drmTarget.ncol) = " + drmTarget.ncol)
+ val interceptCol = drmTarget.ncol - 1
+ //val targetMean: Double = drmTarget
+ val targetMean: Double = drmTarget.colMeans().get(0)
+
+ val rssint: Double = ((drmTarget - targetMean ).t %*% (drmTarget -
targetMean)).zSum()
+ // ete above is the RSS for the calculated model
+
+ //println(" model.beta(0) = " + model.beta(0))
+ //println(" model.beta(interceptCol) = " + model.beta(interceptCol))
+ //println("rssint = " + rssint)
+ //println("rssmod = " + rssmod)
+
+ val groupDof = drmFeatures.ncol-1
+ val fScore = ((rssint - model.rss) / groupDof) / ( model.rss /
(drmFeatures.nrow - groupDof- 1 ))
--- End diff --
this line is the crux of it- Looks good, but I'll feel better if you can
verify with an R-prototype
> Add F-test to Linear Regression Fitness Tests
> ----------------------------------------------
>
> Key: MAHOUT-1962
> URL: https://issues.apache.org/jira/browse/MAHOUT-1962
> Project: Mahout
> Issue Type: Improvement
> Components: Algorithms
> Affects Versions: 0.12.0, 0.12.1, 0.13.0, 0.12.2
> Reporter: Dustin VanStee
> Priority: Minor
> Labels: beginner
> Fix For: 0.13.1
>
> Original Estimate: 96h
> Remaining Estimate: 96h
>
> This update will modify
> org.apache.mahout.math.algorithms.regression.tests.FittnessTests.scala and
> add an overall Ftest for significance of one or more parameters being not
> equal to zero.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)