spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smurakozi <...@git.apache.org>
Subject [GitHub] spark pull request #19599: [SPARK-22381] [ML] Add StringParam that supports ...
Date Tue, 12 Dec 2017 11:41:44 GMT
Github user smurakozi commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19599#discussion_r156339663
  
    --- Diff: mllib/src/main/scala/org/apache/spark/ml/param/params.scala ---
    @@ -435,6 +435,43 @@ class BooleanParam(parent: String, name: String, doc: String) //
No need for isV
       }
     }
     
    +/**
    + * :: DeveloperApi ::
    + * Specialized version of `Param[String]` for Java.
    + */
    +@DeveloperApi
    +class StringParam(parent: Params, name: String, doc: String, isValid: String => Boolean)
    +  extends Param[String](parent, name, doc, isValid) {
    +
    +  private var options: Option[Array[String]] = None
    +
    +  def this(parent: Params, name: String, doc: String) =
    +    this(parent, name, doc, ParamValidators.alwaysTrue)
    +
    +  /** construct a StringParam with limited options (case-insensitive) */
    +  def this(parent: Params, name: String, doc: String, options: Array[String]) = {
    +    this(parent, name, doc + s" Supported options (case-insensitive): ${options.mkString(",
")}.",
    --- End diff --
    
    Is this tested somewhere?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message