Skip to content

Commit 70085e8

Browse files
Nick Pentreathsrowen
authored andcommitted
[SPARK-21210][DOC][ML] Javadoc 8 fixes for ML shared param traits
PR #15999 included fixes for doc strings in the ML shared param traits (occurrences of `>` and `>=`). This PR simply uses the HTML-escaped version of the param doc to embed into the Scaladoc, to ensure that when `SharedParamsCodeGen` is run, the generated javadoc will be compliant for Java 8. ## How was this patch tested? Existing tests Author: Nick Pentreath <nickp@za.ibm.com> Closes #18420 from MLnick/shared-params-javadoc8.
1 parent a2d5623 commit 70085e8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package org.apache.spark.ml.param.shared
2020
import java.io.PrintWriter
2121

2222
import scala.reflect.ClassTag
23+
import scala.xml.Utility
2324

2425
/**
2526
* Code generator for shared params (sharedParams.scala). Run under the Spark folder with
@@ -167,14 +168,16 @@ private[shared] object SharedParamsCodeGen {
167168
"def"
168169
}
169170

171+
val htmlCompliantDoc = Utility.escape(doc)
172+
170173
s"""
171174
|/**
172175
| * Trait for shared param $name$defaultValueDoc.
173176
| */
174177
|private[ml] trait Has$Name extends Params {
175178
|
176179
| /**
177-
| * Param for $doc.
180+
| * Param for $htmlCompliantDoc.
178181
| * @group ${groupStr(0)}
179182
| */
180183
| final val $name: $Param = new $Param(this, "$name", "$doc"$isValid)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private[ml] trait HasThreshold extends Params {
176176
private[ml] trait HasThresholds extends Params {
177177

178178
/**
179-
* Param for Thresholds in multi-class classification to adjust the probability of predicting each class. Array must have length equal to the number of classes, with values > 0 excepting that at most one value may be 0. The class with largest value p/t is predicted, where p is the original probability of that class and t is the class's threshold.
179+
* Param for Thresholds in multi-class classification to adjust the probability of predicting each class. Array must have length equal to the number of classes, with values &gt; 0 excepting that at most one value may be 0. The class with largest value p/t is predicted, where p is the original probability of that class and t is the class's threshold.
180180
* @group param
181181
*/
182182
final val thresholds: DoubleArrayParam = new DoubleArrayParam(this, "thresholds", "Thresholds in multi-class classification to adjust the probability of predicting each class. Array must have length equal to the number of classes, with values > 0 excepting that at most one value may be 0. The class with largest value p/t is predicted, where p is the original probability of that class and t is the class's threshold", (t: Array[Double]) => t.forall(_ >= 0) && t.count(_ == 0) <= 1)

0 commit comments

Comments
 (0)