Github user WeichenXu123 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17862#discussion_r145371704
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/classification/LinearSVC.scala ---
    @@ -42,7 +44,26 @@ import org.apache.spark.sql.functions.{col, lit}
     /** Params for linear SVM Classifier. */
     private[classification] trait LinearSVCParams extends ClassifierParams 
with HasRegParam
       with HasMaxIter with HasFitIntercept with HasTol with HasStandardization 
with HasWeightCol
    -  with HasAggregationDepth with HasThreshold {
    +  with HasAggregationDepth with HasThreshold with HasSolver {
    +
    +  /**
    +   * Specifies the loss function. Currently "hinge" and "squared_hinge" 
are supported.
    +   * "hinge" is the standard SVM loss (a.k.a. L1 loss) while 
"squared_hinge" is the square of
    +   * the hinge loss (a.k.a. L2 loss).
    +   *
    +   * @see <a href="https://en.wikipedia.org/wiki/Hinge_loss";>Hinge loss 
(Wikipedia)</a>
    +   *
    +   * @group param
    +   */
    +  @Since("2.3.0")
    +  final val loss: Param[String] = new Param(this, "loss", "Specifies the 
loss " +
    +    "function. hinge is the standard SVM loss while squared_hinge is the 
square of the hinge loss.",
    +    (s: String) => 
LinearSVC.supportedLoss.contains(s.toLowerCase(Locale.ROOT)))
    --- End diff --
    
    The `isValid` function you can use
    `ParamValidators.inArray[String](supportedLosses))`


---

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

Reply via email to