Skip to content

Commit

Permalink
[SPARK-9118] [ML] Implement IntArrayParam in mllib
Browse files Browse the repository at this point in the history
Implement IntArrayParam in mllib

Author: Rekha Joshi <rekhajoshm@gmail.com>
Author: Joshi <rekhajoshm@gmail.com>

Closes apache#7481 from rekhajoshm/SPARK-9118 and squashes the following commits:

d3b1766 [Joshi] Implement IntArrayParam
0be142d [Rekha Joshi] Merge pull request #3 from apache/master
106fd8e [Rekha Joshi] Merge pull request #2 from apache/master
e3677c9 [Rekha Joshi] Merge pull request #1 from apache/master
  • Loading branch information
rekhajoshm authored and mengxr committed Jul 18, 2015
1 parent 34a889d commit 1017908
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 1017908

Please sign in to comment.