[ 
https://issues.apache.org/jira/browse/SPARK-18518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15701099#comment-15701099
 ] 

zhengruifeng commented on SPARK-18518:
--------------------------------------

I think three places need to modify:
1, make param support non-final, like:
{code}
private case class ParamDesc[T: ClassTag](
      name: String,
      doc: String,
      defaultValueStr: Option[String] = None,
      isValid: String = "",
      finalFields: Boolean = true,          // new option to control whether 
generated param have a final field or not
      finalMethods: Boolean = true,
      isExpertParam: Boolean = false) {
{code}

2, generate {{HasSolver}} with {{finalFields = false}} 

3, override {{HasSolver}} in subclasses: LiR, GLR, MLPC

I will send a corresponding PR.

> HasSolver should support allowed values
> ---------------------------------------
>
>                 Key: SPARK-18518
>                 URL: https://issues.apache.org/jira/browse/SPARK-18518
>             Project: Spark
>          Issue Type: Improvement
>          Components: ML
>            Reporter: zhengruifeng
>            Assignee: zhengruifeng
>
> {{HasSolver}} now don't support value validation, so it's not easy to use:
> GLR and LiR inherit HasSolver, but need to do param validation explicitly 
> like:
> {code}
> require(Set("auto", "l-bfgs", "normal").contains(value),
>       s"Solver $value was not supported. Supported options: auto, l-bfgs, 
> normal")
>     set(solver, value)
> {code}
> MLPC even don't inherit {{HasSolver}}, and create param solver with 
> supportedSolvers:
> {code}
>   final val solver: Param[String] = new Param[String](this, "solver",
>     "The solver algorithm for optimization. Supported options: " +
>       s"${MultilayerPerceptronClassifier.supportedSolvers.mkString(", ")}. 
> (Default l-bfgs)",
>     
> ParamValidators.inArray[String](MultilayerPerceptronClassifier.supportedSolvers))
> {code}
> It may be reasonable to modify {{HasSolver}} after 2.1



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to