Skip to content

Commit

Permalink
Fix failed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lewuathe committed Jun 22, 2015
1 parent ee5de46 commit 8fadebd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,10 @@ class StreamingLinearRegressionWithSGD private[mllib] (
this
}

/** Set the convergence tolerance. */
def setConvergenceTol(tolerance: Double): this.type = {
this.algorithm.optimizer.setConvergenceTol(tolerance)
this
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ class LogisticRegressionSuite extends SparkFunSuite with MLlibTestSparkContext w
.setStepSize(10.0)
.setRegParam(0.0)
.setNumIterations(20)
.setConvergenceTol(0.0005)

val model = lr.run(testRDD)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class LBFGSSuite extends SparkFunSuite with MLlibTestSparkContext with Matchers
numGDIterations,
regParam,
miniBatchFrac,
initialWeightsWithIntercept)
initialWeightsWithIntercept,
convergenceTol)

assert(lossGD(0) ~= lossLBFGS(0) absTol 1E-5,
"The first losses of LBFGS and GD should be the same.")
Expand Down Expand Up @@ -221,7 +222,8 @@ class LBFGSSuite extends SparkFunSuite with MLlibTestSparkContext with Matchers
numGDIterations,
regParam,
miniBatchFrac,
initialWeightsWithIntercept)
initialWeightsWithIntercept,
convergenceTol)

// for class LBFGS and the optimize method, we only look at the weights
assert(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class StreamingLinearRegressionSuite extends SparkFunSuite with TestSuiteBase {
.setInitialWeights(Vectors.dense(0.0, 0.0))
.setStepSize(0.2)
.setNumIterations(25)
.setConvergenceTol(0.0001)

// generate sequence of simulated data
val numBatches = 10
Expand Down

0 comments on commit 8fadebd

Please sign in to comment.