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

    https://github.com/apache/spark/pull/6308#discussion_r30856565
  
    --- Diff: mllib/src/test/scala/org/apache/spark/ml/param/ParamsSuite.scala 
---
    @@ -201,3 +201,23 @@ class ParamsSuite extends FunSuite {
         assert(inArray(1) && inArray(2) && !inArray(0))
       }
     }
    +
    +object ParamsSuite extends FunSuite {
    +
    +  /**
    +   * Checks common requirements for [[Params.params]]: 1) number of 
params; 2) params are ordered
    +   * by names; 3) param parent has the same UID as the object's UID; 4) 
param name is the same as
    +   * the param method name.
    +   */
    +  def checkParams(obj: Params, expectedNumParams: Int): Unit = {
    +    val params = obj.params
    +    require(params.length === expectedNumParams,
    +      s"Expect $expectedNumParams params but got ${params.length}: 
${params.map(_.name).toSeq}.")
    +    val paramNames = params.map(_.name)
    +    require(paramNames === paramNames.sorted)
    +    params.foreach { p =>
    +      assert(p.parent === obj.uid)
    +      assert(obj.getParam(p.name) === p)
    --- End diff --
    
    Is it valid to assume that param and getParam are always paired? I can do 
this in a separate PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to