-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-14585][ML][WIP] Provide accessor methods for Pipeline stages #12420
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
Conversation
|
test this please |
|
Test build #56401 has finished for PR 12420 at commit
|
|
@pravingadakh Thanks! This is what I had in mind. In your tests, could you please add Java unit tests too to make sure these are Java-friendly? Also, please check the type and throw exceptions when the type does not match. I'd recommend throwing IllegalArgumentException and specifying the expected and actual types. |
|
|
||
| /** Returns stage at index i in Pipeline */ | ||
| @Since("2.0.0") | ||
| def getStage[T <: PipelineStage](i: Int): T = getStages.apply(i).asInstanceOf[T] |
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.
Here and elsewhere, I would just write array(i) instead of array.apply(i)
Also, can you please document the @tparam?
|
@jkbradley I'll update the PR accordingly. |
|
By the way, we'll need to get this merged quickly for it to make 2.0. (Thanks!) |
|
@jkbradley I'll update it soon. |
|
@jkbradley I have stumbled across an issue, would really appreciate your input. Have a look at this method: How do I avoid usage of |
|
Can one of the admins verify this patch? |
| def getStages: Array[PipelineStage] = $(stages).clone() | ||
|
|
||
| /** Returns stage at index i in Pipeline */ | ||
| @Since("2.0.0") |
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.
Can't be since 2.0.0 at this point. Also use a @return tag in the docs.
| /** Returns all stages of this type */ | ||
| @Since("2.0.0") | ||
| def getStagesOfType[T <: PipelineStage]: Array[T] = { | ||
| getStages.collect { |
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.
Nit: This is probably more natural as a one-liner
|
@pravingadakh Will you be able to continue with this? Thanks! |
|
I missed the ClassTag question above. Let me take a look |
|
Well, after spending a while looking around, I haven't found a good way to write this and make it Java friendly (i.e., not use ClassTag, Type, or TypeTag). Does anyone else have ideas? I'll try to return to this before long... |
|
Hi @@pravingadakh, is this still active? |
What changes were proposed in this pull request?
This PR adds accessor methods for pipeline stages in
PipelineandPipelineModelclasses.@jkbradley Hi, please validate if this is something that you had in mind. If so, I can start on test cases for these.