Skip to content

Commit

Permalink
[SPARK-21210][DOC][ML] Javadoc 8 fixes for ML shared param traits
Browse files Browse the repository at this point in the history
PR apache#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 <[email protected]>

Closes apache#18420 from MLnick/shared-params-javadoc8.
  • Loading branch information
Nick Pentreath authored and srowen committed Jun 29, 2017
1 parent a2d5623 commit 70085e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.apache.spark.ml.param.shared
import java.io.PrintWriter

import scala.reflect.ClassTag
import scala.xml.Utility

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

val htmlCompliantDoc = Utility.escape(doc)

s"""
|/**
| * Trait for shared param $name$defaultValueDoc.
| */
|private[ml] trait Has$Name extends Params {
|
| /**
| * Param for $doc.
| * Param for $htmlCompliantDoc.
| * @group ${groupStr(0)}
| */
| final val $name: $Param = new $Param(this, "$name", "$doc"$isValid)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private[ml] trait HasThreshold extends Params {
private[ml] trait HasThresholds extends Params {

/**
* 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.
* 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.
* @group param
*/
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)
Expand Down

0 comments on commit 70085e8

Please sign in to comment.