Skip to content

Commit b33556b

Browse files
committed
Fix style. Revert deprecated methods.
1 parent 7a5be12 commit b33556b

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

docs/ml-guide.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ and the migration guide below will explain all changes between releases.
117117
`stringOrderType` param in `StringIndexer`, in case of equal frequency, the order of
118118
strings is undefined. Since Spark 3.0, the strings with equal frequency are further
119119
sorted by alphabet. And since Spark 3.0, `StringIndexer` supports encoding multiple
120-
columns. Because of this change, `StringIndexerModel`'s public constructor `def this(uid: String, labels: Array[String])`
121-
is not available. Since Spark 3.0, Developers can use `def this(uid: String, labelsArray: Array[Array[String]])` instead.
120+
columns.
122121

123122
## From 2.2 to 2.3
124123

mllib/src/main/scala/org/apache/spark/ml/feature/StringIndexer.scala

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,19 @@ object StringIndexer extends DefaultParamsReadable[StringIndexer] {
280280
private[feature] def getSortFunc(
281281
ascending: Boolean): ((String, Long), (String, Long)) => Boolean = {
282282
if (ascending) {
283-
(a: (String, Long), b: (String, Long)) => {
284-
if (a._2 == b._2) {
285-
a._1 < b._1
286-
} else {
287-
a._2 < b._2
288-
}
289-
}
283+
{ case ((strA: String, freqA: Long), (strB: String, freqB: Long)) =>
284+
if (freqA == freqB) {
285+
strA < strB
286+
} else {
287+
freqA < freqB
288+
}
289+
}
290290
} else {
291-
(a: (String, Long), b: (String, Long)) => {
292-
if (a._2 == b._2) {
293-
a._1 < b._1
291+
{ case ((strA: String, freqA: Long), (strB: String, freqB: Long)) =>
292+
if (freqA == freqB) {
293+
strA < strB
294294
} else {
295-
a._2 > b._2
295+
freqA > freqB
296296
}
297297
}
298298
}
@@ -318,8 +318,9 @@ class StringIndexerModel (
318318

319319
import StringIndexerModel._
320320

321-
@deprecated("`this(labels: Array[String])` is deprecated and will be removed in 3.1.0. " +
322-
"Use `this(labelsArray: Array[Array[String]])` instead.", "3.0.0")
321+
@Since("1.5.0")
322+
def this(uid: String, labels: Array[String]) = this(uid, Array(labels))
323+
323324
@Since("1.5.0")
324325
def this(labels: Array[String]) = this(Identifiable.randomUID("strIdx"), Array(labels))
325326

0 commit comments

Comments
 (0)