Skip to content

Commit

Permalink
Rename the method getInitializationSteps to getInitSteps and
Browse files Browse the repository at this point in the history
`setInitializationSteps` to `setInitSteps` in Scala and Python
  • Loading branch information
yu-iskw committed Jul 16, 2015
1 parent f43f5b4 commit b2c205c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private[clustering] trait KMeansParams
(value: Int) => value > 0)

/** @group getParam */
def getInitializationSteps: Int = $(initSteps)
def getInitSteps: Int = $(initSteps)

/**
* Validates and transforms the input schema.
Expand Down Expand Up @@ -167,7 +167,7 @@ class KMeans(override val uid: String) extends Estimator[KMeansModel] with KMean
def setInitMode(value: String): this.type = set(initMode, value)

/** @group setParam */
def setInitializationSteps(value: Int): this.type = set(initSteps, value)
def setInitSteps(value: Int): this.type = set(initSteps, value)

/** @group setParam */
def setMaxIter(value: Int): this.type = set(maxIter, value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {
assert(kmeans.getMaxIter === 20)
assert(kmeans.getRuns === 1)
assert(kmeans.getInitMode === MLlibKMeans.K_MEANS_PARALLEL)
assert(kmeans.getInitializationSteps === 5)
assert(kmeans.getInitSteps === 5)
assert(kmeans.getEpsilon === 1e-4)
}

Expand All @@ -66,7 +66,7 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {
.setMaxIter(33)
.setRuns(7)
.setInitMode(MLlibKMeans.RANDOM)
.setInitializationSteps(3)
.setInitSteps(3)
.setSeed(123)
.setEpsilon(1e-3)

Expand All @@ -76,7 +76,7 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {
assert(kmeans.getMaxIter === 33)
assert(kmeans.getRuns === 7)
assert(kmeans.getInitMode === MLlibKMeans.RANDOM)
assert(kmeans.getInitializationSteps === 3)
assert(kmeans.getInitSteps === 3)
assert(kmeans.getSeed === 123)
assert(kmeans.getEpsilon === 1e-3)
}
Expand All @@ -89,7 +89,7 @@ class KMeansSuite extends SparkFunSuite with MLlibTestSparkContext {
new KMeans().setInitMode("no_such_a_mode")
}
intercept[IllegalArgumentException] {
new KMeans().setInitializationSteps(0)
new KMeans().setInitSteps(0)
}
intercept[IllegalArgumentException] {
new KMeans().setRuns(0)
Expand Down
8 changes: 4 additions & 4 deletions python/pyspark/ml/clustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,18 +167,18 @@ def getInitMode(self):
"""
return self.getOrDefault(self.initMode)

def setInitializationSteps(self, value):
def setInitSteps(self, value):
"""
Sets the value of :py:attr:`initSteps`.
>>> algo = KMeans().setInitializationSteps(10)
>>> algo.getInitializationSteps()
>>> algo = KMeans().setInitSteps(10)
>>> algo.getInitSteps()
10
"""
self._paramMap[self.initSteps] = value
return self

def getInitializationSteps(self):
def getInitSteps(self):
"""
Gets the value of `initSteps`
"""
Expand Down

0 comments on commit b2c205c

Please sign in to comment.