-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-7388][SPARK-7383] wrapper for VectorAssembler in Python #5930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7f7ea2a
39ecb07
99c2ebf
c81072d
c221db9
73e745f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -220,19 +220,15 @@ class BooleanParam(parent: Params, name: String, doc: String) // No need for isV | |
| } | ||
|
|
||
| /** Specialized version of [[Param[Array[T]]]] for Java. */ | ||
| class ArrayParam[T : ClassTag]( | ||
| parent: Params, | ||
| name: String, | ||
| doc: String, | ||
| isValid: Array[T] => Boolean) | ||
| extends Param[Array[T]](parent, name, doc, isValid) { | ||
| class StringArrayParam(parent: Params, name: String, doc: String, isValid: Array[String] => Boolean) | ||
| extends Param[Array[String]](parent, name, doc, isValid) { | ||
|
|
||
| def this(parent: Params, name: String, doc: String) = | ||
| this(parent, name, doc, ParamValidators.alwaysTrue) | ||
|
|
||
| override def w(value: Array[T]): ParamPair[Array[T]] = super.w(value) | ||
| override def w(value: Array[String]): ParamPair[Array[String]] = super.w(value) | ||
|
|
||
| private[param] def wCast(value: Seq[T]): ParamPair[Array[T]] = w(value.toArray) | ||
| private[param] def wCast(value: Seq[String]): ParamPair[Array[String]] = w(value.toArray) | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -328,8 +324,8 @@ trait Params extends Identifiable with Serializable { | |
| */ | ||
| protected final def set[T](param: Param[T], value: T): this.type = { | ||
| shouldOwn(param) | ||
| if (param.isInstanceOf[ArrayParam[_]] && value.isInstanceOf[Seq[_]]) { | ||
| paramMap.put(param.asInstanceOf[ArrayParam[Any]].wCast(value.asInstanceOf[Seq[Any]])) | ||
| if (param.isInstanceOf[StringArrayParam] && value.isInstanceOf[Seq[_]]) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is specialized for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this going to help with the Python Api though? We don't have ParamPair in Python do we? |
||
| paramMap.put(param.asInstanceOf[StringArrayParam].wCast(value.asInstanceOf[Seq[String]])) | ||
| } else { | ||
| paramMap.put(param.w(value)) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would renaming
wCast->wwork? I think it should compile.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It compiles but it doesn't work... The current state is the only way I got it to work.