Github user hhbyyh commented on a diff in the pull request:
https://github.com/apache/spark/pull/17862#discussion_r146165449
--- 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 --
Correct me if I'm wrong, IMO we need toLowerCase here.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]