Skip to content

Commit

Permalink
Implement IntArrayParam
Browse files Browse the repository at this point in the history
  • Loading branch information
rekhajoshm committed Jul 17, 2015
1 parent 0be142d commit d3b1766
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mllib/src/main/scala/org/apache/spark/ml/param/params.scala
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,22 @@ class DoubleArrayParam(parent: Params, name: String, doc: String, isValid: Array
w(value.asScala.map(_.asInstanceOf[Double]).toArray)
}

/**
* :: DeveloperApi ::
* Specialized version of [[Param[Array[Int]]]] for Java.
*/
@DeveloperApi
class IntArrayParam(parent: Params, name: String, doc: String, isValid: Array[Int] => Boolean)
extends Param[Array[Int]](parent, name, doc, isValid) {

def this(parent: Params, name: String, doc: String) =
this(parent, name, doc, ParamValidators.alwaysTrue)

/** Creates a param pair with a [[java.util.List]] of values (for Java and Python). */
def w(value: java.util.List[java.lang.Integer]): ParamPair[Array[Int]] =
w(value.asScala.map(_.asInstanceOf[Int]).toArray)
}

/**
* :: Experimental ::
* A param and its value.
Expand Down

0 comments on commit d3b1766

Please sign in to comment.