Skip to content

Commit b1a3c42

Browse files
author
DB Tsai
committed
first commit
1 parent 5fdcbdc commit b1a3c42

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mllib/src/test/scala/org/apache/spark/mllib/classification/LogisticRegressionSuite.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,16 @@ class LogisticRegressionSuite extends FunSuite with MLlibTestSparkContext with M
178178
// Use half as many iterations as the previous test.
179179
val lr = new LogisticRegressionWithSGD().setIntercept(true)
180180
lr.optimizer.
181-
setStepSize(10.0).
181+
setStepSize(1.0).
182182
setNumIterations(10).
183183
setRegParam(1.0)
184184

185185
val model = lr.run(testRDD, initialWeights)
186186

187187
// Test the weights
188-
assert(model.weights(0) ~== -430000.0 relTol 20000.0)
189-
assert(model.intercept ~== 370000.0 relTol 20000.0)
188+
// With regularization, the resulting weights will be smaller.
189+
assert(model.weights(0) ~== -0.14 relTol 0.02)
190+
assert(model.intercept ~== 0.25 relTol 0.02)
190191

191192
val validationData = LogisticRegressionSuite.generateLogisticInput(A, B, nPoints, 17)
192193
val validationRDD = sc.parallelize(validationData, 2)

0 commit comments

Comments
 (0)