Skip to content
Snippets Groups Projects
Commit 6181937f authored by MechCoder's avatar MechCoder Committed by Xiangrui Meng
Browse files

[SPARK-7946] [MLLIB] DecayFactor wrongly set in StreamingKMeans

Author: MechCoder <manojkumarsivaraj334@gmail.com>

Closes #6497 from MechCoder/spark-7946 and squashes the following commits:

2fdd0a3 [MechCoder] Add non-regression test
8c988c6 [MechCoder] [SPARK-7946] DecayFactor wrongly set in StreamingKMeans
parent 4782e130
No related branches found
No related tags found
No related merge requests found
......@@ -178,7 +178,7 @@ class StreamingKMeans(
/** Set the decay factor directly (for forgetful algorithms). */
def setDecayFactor(a: Double): this.type = {
this.decayFactor = decayFactor
this.decayFactor = a
this
}
......
......@@ -133,6 +133,13 @@ class StreamingKMeansSuite extends FunSuite with TestSuiteBase {
assert(math.abs(c1) ~== 0.8 absTol 0.6)
}
test("SPARK-7946 setDecayFactor") {
val kMeans = new StreamingKMeans()
assert(kMeans.decayFactor === 1.0)
kMeans.setDecayFactor(2.0)
assert(kMeans.decayFactor === 2.0)
}
def StreamingKMeansDataGenerator(
numPoints: Int,
numBatches: Int,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment