Skip to content

Commit 2dfabec

Browse files
zhengruifengyanboliang
authored andcommitted
[SPARK-18520][ML] Add missing setXXXCol methods for BisectingKMeansModel and GaussianMixtureModel
## What changes were proposed in this pull request? add `setFeaturesCol` and `setPredictionCol` for BiKModel and GMModel add `setProbabilityCol` for GMModel ## How was this patch tested? existing tests Author: Zheng RuiFeng <[email protected]> Closes #15957 from zhengruifeng/bikm_set.
1 parent 223fa21 commit 2dfabec

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

mllib/src/main/scala/org/apache/spark/ml/clustering/BisectingKMeans.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ class BisectingKMeansModel private[ml] (
9898
copied.setSummary(trainingSummary).setParent(this.parent)
9999
}
100100

101+
/** @group setParam */
102+
@Since("2.1.0")
103+
def setFeaturesCol(value: String): this.type = set(featuresCol, value)
104+
105+
/** @group setParam */
106+
@Since("2.1.0")
107+
def setPredictionCol(value: String): this.type = set(predictionCol, value)
108+
101109
@Since("2.0.0")
102110
override def transform(dataset: Dataset[_]): DataFrame = {
103111
transformSchema(dataset.schema, logging = true)

mllib/src/main/scala/org/apache/spark/ml/clustering/GaussianMixture.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ class GaussianMixtureModel private[ml] (
8787
@Since("2.0.0") val gaussians: Array[MultivariateGaussian])
8888
extends Model[GaussianMixtureModel] with GaussianMixtureParams with MLWritable {
8989

90+
/** @group setParam */
91+
@Since("2.1.0")
92+
def setFeaturesCol(value: String): this.type = set(featuresCol, value)
93+
94+
/** @group setParam */
95+
@Since("2.1.0")
96+
def setPredictionCol(value: String): this.type = set(predictionCol, value)
97+
98+
/** @group setParam */
99+
@Since("2.1.0")
100+
def setProbabilityCol(value: String): this.type = set(probabilityCol, value)
101+
90102
@Since("2.0.0")
91103
override def copy(extra: ParamMap): GaussianMixtureModel = {
92104
val copied = copyValues(new GaussianMixtureModel(uid, weights, gaussians), extra)

0 commit comments

Comments
 (0)