Skip to content

Commit a9dbf59

Browse files
committed
minor updates
1 parent d9302b8 commit a9dbf59

File tree

5 files changed

+26
-32
lines changed

5 files changed

+26
-32
lines changed

mllib/src/main/scala/org/apache/spark/ml/classification/Classifier.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ import org.apache.spark.sql.types.{DataType, DoubleType, StructType}
3737
private[spark] trait ClassifierParams extends PredictorParams
3838
with HasRawPredictionCol {
3939

40-
setDefault(rawPredictionCol, "rawPrediction")
41-
4240
override protected def validateAndTransformSchema(
4341
schema: StructType,
4442
paramMap: ParamMap,

mllib/src/main/scala/org/apache/spark/ml/evaluation/BinaryClassificationEvaluator.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ import org.apache.spark.sql.types.DoubleType
3636
class BinaryClassificationEvaluator extends Evaluator with Params
3737
with HasRawPredictionCol with HasLabelCol {
3838

39+
setDefault(metricName -> "areaUnderROC")
40+
3941
/**
4042
* param for metric name in evaluation
4143
* @group param

mllib/src/main/scala/org/apache/spark/ml/param/shared/SharedParamCodeGen.scala

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private[shared] object SharedParamCodeGen {
105105
val setDefault = defaultValue.map { v =>
106106
s"""
107107
| setDefault($name, $v)
108-
""".stripMargin
108+
|""".stripMargin
109109
}.getOrElse("")
110110

111111
s"""
@@ -125,14 +125,13 @@ private[shared] object SharedParamCodeGen {
125125
| /** @group getParam */
126126
| final def get$Name: $T = get($name)
127127
|}
128-
""".stripMargin
128+
|""".stripMargin
129129
}
130130

131131
/** Generates Scala source code for the input params with header. */
132132
private def genSharedParams(params: Seq[ParamDesc[_]]): String = {
133133
val header =
134-
"""
135-
|/*
134+
"""/*
136135
| * Licensed to the Apache Software Foundation (ASF) under one or more
137136
| * contributor license agreements. See the NOTICE file distributed with
138137
| * this work for additional information regarding copyright ownership.
@@ -157,12 +156,9 @@ private[shared] object SharedParamCodeGen {
157156
|// DO NOT MODIFY THIS FILE! It was generated by SharedParamCodeGen.
158157
|
159158
|// scalastyle:off
160-
""".stripMargin
159+
|""".stripMargin
161160

162-
val footer =
163-
"""
164-
|// scalastyle:on
165-
""".stripMargin
161+
val footer = "// scalastyle:on\n"
166162

167163
val traits = params.map(genHasParamTrait).mkString
168164

mllib/src/main/scala/org/apache/spark/ml/param/shared/sharedParams.scala

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Licensed to the Apache Software Foundation (ASF) under one or more
43
* contributor license agreements. See the NOTICE file distributed with
@@ -24,7 +23,7 @@ import org.apache.spark.ml.param._
2423
// DO NOT MODIFY THIS FILE! It was generated by SharedParamCodeGen.
2524

2625
// scalastyle:off
27-
26+
2827
/**
2928
* :: DeveloperApi ::
3029
* Trait for shared param regParam.
@@ -41,7 +40,7 @@ trait HasRegParam extends Params {
4140
/** @group getParam */
4241
final def getRegParam: Double = get(regParam)
4342
}
44-
43+
4544
/**
4645
* :: DeveloperApi ::
4746
* Trait for shared param maxIter.
@@ -58,7 +57,7 @@ trait HasMaxIter extends Params {
5857
/** @group getParam */
5958
final def getMaxIter: Int = get(maxIter)
6059
}
61-
60+
6261
/**
6362
* :: DeveloperApi ::
6463
* Trait for shared param featuresCol (default: "features").
@@ -67,7 +66,7 @@ trait HasMaxIter extends Params {
6766
trait HasFeaturesCol extends Params {
6867

6968
setDefault(featuresCol, "features")
70-
69+
7170
/**
7271
* Param for features column name.
7372
* @group param
@@ -77,7 +76,7 @@ trait HasFeaturesCol extends Params {
7776
/** @group getParam */
7877
final def getFeaturesCol: String = get(featuresCol)
7978
}
80-
79+
8180
/**
8281
* :: DeveloperApi ::
8382
* Trait for shared param labelCol (default: "label").
@@ -86,7 +85,7 @@ trait HasFeaturesCol extends Params {
8685
trait HasLabelCol extends Params {
8786

8887
setDefault(labelCol, "label")
89-
88+
9089
/**
9190
* Param for label column name.
9291
* @group param
@@ -96,7 +95,7 @@ trait HasLabelCol extends Params {
9695
/** @group getParam */
9796
final def getLabelCol: String = get(labelCol)
9897
}
99-
98+
10099
/**
101100
* :: DeveloperApi ::
102101
* Trait for shared param predictionCol (default: "prediction").
@@ -105,7 +104,7 @@ trait HasLabelCol extends Params {
105104
trait HasPredictionCol extends Params {
106105

107106
setDefault(predictionCol, "prediction")
108-
107+
109108
/**
110109
* Param for prediction column name.
111110
* @group param
@@ -115,7 +114,7 @@ trait HasPredictionCol extends Params {
115114
/** @group getParam */
116115
final def getPredictionCol: String = get(predictionCol)
117116
}
118-
117+
119118
/**
120119
* :: DeveloperApi ::
121120
* Trait for shared param rawPredictionCol (default: "rawPrediction").
@@ -124,7 +123,7 @@ trait HasPredictionCol extends Params {
124123
trait HasRawPredictionCol extends Params {
125124

126125
setDefault(rawPredictionCol, "rawPrediction")
127-
126+
128127
/**
129128
* Param for raw prediction (a.k.a. confidence) column name.
130129
* @group param
@@ -134,7 +133,7 @@ trait HasRawPredictionCol extends Params {
134133
/** @group getParam */
135134
final def getRawPredictionCol: String = get(rawPredictionCol)
136135
}
137-
136+
138137
/**
139138
* :: DeveloperApi ::
140139
* Trait for shared param probabilityCol (default: "probability").
@@ -143,7 +142,7 @@ trait HasRawPredictionCol extends Params {
143142
trait HasProbabilityCol extends Params {
144143

145144
setDefault(probabilityCol, "probability")
146-
145+
147146
/**
148147
* Param for column name for predicted class conditional probabilities.
149148
* @group param
@@ -153,7 +152,7 @@ trait HasProbabilityCol extends Params {
153152
/** @group getParam */
154153
final def getProbabilityCol: String = get(probabilityCol)
155154
}
156-
155+
157156
/**
158157
* :: DeveloperApi ::
159158
* Trait for shared param threshold.
@@ -170,7 +169,7 @@ trait HasThreshold extends Params {
170169
/** @group getParam */
171170
final def getThreshold: Double = get(threshold)
172171
}
173-
172+
174173
/**
175174
* :: DeveloperApi ::
176175
* Trait for shared param inputCol.
@@ -187,7 +186,7 @@ trait HasInputCol extends Params {
187186
/** @group getParam */
188187
final def getInputCol: String = get(inputCol)
189188
}
190-
189+
191190
/**
192191
* :: DeveloperApi ::
193192
* Trait for shared param outputCol.
@@ -204,7 +203,7 @@ trait HasOutputCol extends Params {
204203
/** @group getParam */
205204
final def getOutputCol: String = get(outputCol)
206205
}
207-
206+
208207
/**
209208
* :: DeveloperApi ::
210209
* Trait for shared param checkpointInterval.
@@ -221,6 +220,4 @@ trait HasCheckpointInterval extends Params {
221220
/** @group getParam */
222221
final def getCheckpointInterval: Int = get(checkpointInterval)
223222
}
224-
225223
// scalastyle:on
226-

mllib/src/main/scala/org/apache/spark/ml/recommendation/ALS.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ import org.apache.spark.util.random.XORShiftRandom
5151
private[recommendation] trait ALSParams extends Params with HasMaxIter with HasRegParam
5252
with HasPredictionCol with HasCheckpointInterval {
5353

54-
setDefault(rank -> 10, numUserBlocks -> 10, numItemBlocks -> 10, implicitPrefs -> false,
55-
alpha -> 1.0, userCol -> "user", itemCol -> "item", ratingCol -> "rating", nonnegative -> false)
54+
setDefault(rank -> 10, maxIter -> 10, regParam -> 0.1, numUserBlocks -> 10, numItemBlocks -> 10,
55+
implicitPrefs -> false, alpha -> 1.0, userCol -> "user", itemCol -> "item",
56+
ratingCol -> "rating", nonnegative -> false)
5657

5758
/**
5859
* Param for rank of the matrix factorization.

0 commit comments

Comments
 (0)