File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed
main/scala/org/apache/spark/mllib/clustering
test/scala/org/apache/spark/mllib/clustering Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ class StreamingKMeans(
179179
180180 /** Set the decay factor directly (for forgetful algorithms). */
181181 def setDecayFactor (a : Double ): this .type = {
182- this .decayFactor = decayFactor
182+ this .decayFactor = a
183183 this
184184 }
185185
Original file line number Diff line number Diff line change @@ -133,6 +133,13 @@ class StreamingKMeansSuite extends FunSuite with TestSuiteBase {
133133 assert(math.abs(c1) ~== 0.8 absTol 0.6 )
134134 }
135135
136+ test(" SPARK-7946 setDecayFactor" ) {
137+ val kMeans = new StreamingKMeans ()
138+ assert(kMeans.decayFactor === 1.0 )
139+ kMeans.setDecayFactor(2.0 )
140+ assert(kMeans.decayFactor === 2.0 )
141+ }
142+
136143 def StreamingKMeansDataGenerator (
137144 numPoints : Int ,
138145 numBatches : Int ,
You can’t perform that action at this time.
0 commit comments