Skip to content

Commit 1017908

Browse files
rekhajoshmmengxr
authored andcommitted
[SPARK-9118] [ML] Implement IntArrayParam in mllib
Implement IntArrayParam in mllib Author: Rekha Joshi <[email protected]> Author: Joshi <[email protected]> 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
1 parent 34a889d commit 1017908

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

mllib/src/main/scala/org/apache/spark/ml/param/params.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,22 @@ class DoubleArrayParam(parent: Params, name: String, doc: String, isValid: Array
295295
w(value.asScala.map(_.asInstanceOf[Double]).toArray)
296296
}
297297

298+
/**
299+
* :: DeveloperApi ::
300+
* Specialized version of [[Param[Array[Int]]]] for Java.
301+
*/
302+
@DeveloperApi
303+
class IntArrayParam(parent: Params, name: String, doc: String, isValid: Array[Int] => Boolean)
304+
extends Param[Array[Int]](parent, name, doc, isValid) {
305+
306+
def this(parent: Params, name: String, doc: String) =
307+
this(parent, name, doc, ParamValidators.alwaysTrue)
308+
309+
/** Creates a param pair with a [[java.util.List]] of values (for Java and Python). */
310+
def w(value: java.util.List[java.lang.Integer]): ParamPair[Array[Int]] =
311+
w(value.asScala.map(_.asInstanceOf[Int]).toArray)
312+
}
313+
298314
/**
299315
* :: Experimental ::
300316
* A param and its value.

0 commit comments

Comments
 (0)