-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-15141][EXAMPLE][DOC] Update OneVsRest Examples #12920
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
|
There seems no similar API to directly get |
|
Test build #57841 has finished for PR 12920 at commit
|
|
Test build #57842 has finished for PR 12920 at commit
|
|
Test build #57843 has finished for PR 12920 at commit
|
|
I am not sure if fixing examples can have the component @dongjoon-hyun Do you mind If I ask your thoughts please? |
|
@HyukjinKwon I get your concern, but these examples are actually directly included in the HTML documentation for Spark, via |
|
@zhengruifeng I think the Frankly, the way the example looks now in HTML doc is very confusing with the reference to |
|
@MLnick Agreed. I will remove the args-parsing blocks in the three example files. |
|
+1 @MLnick There are two types of example code under
|
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.
Use SparkSession instead of SQLContext. See #12809 for details.
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.
Thanks!
|
Test build #57948 has finished for PR 12920 at commit
|
|
Test build #57952 has finished for PR 12920 at commit
|
|
@MLnick Args-Parsing was removed in those examples |
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.
I think we should prefer to use ml.evaluation.MulticlassClassificationEvaluator here as it's a DataFrame API example. You may have to change the metric used - see DecisionTreeClassificationExample for example
|
@zhengruifeng made a few comments - most importantly it's better to use the ml evaluators throughout as these are DataFrame API examples. |
|
I have updated codes according to your comments. |
|
Test build #58082 has finished for PR 12920 at commit
|
|
Just use accuracy I think similar to the decision tree example On Sun, 8 May 2016 at 04:21, Ruifeng Zheng notifications@github.com wrote:
|
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: println
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.
Thanks!
|
Test build #58100 has finished for PR 12920 at commit
|
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.
This import is no longer required I believe
|
@zhengruifeng made a few comments. Pending those I think this is ready |
|
@MLnick Thanks. Updated |
|
Test build #58306 has finished for PR 12920 at commit
|
| OneVsRest ovr = new OneVsRest().setClassifier(classifier); | ||
|
|
||
| // train the multiclass model | ||
| // train the multiclass model. |
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.
Sorry one last thing - here we use train.cache() but we don't do that in the other examples. Actually in general we don't seem to do that in any other examples from a quick look. So perhaps remove that and just do ovr.fit(train);
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.
Right. I will fix it
|
Test build #58344 has finished for PR 12920 at commit
|
|
LGTM, merged to master and branch-2.0. Thanks! |
## What changes were proposed in this pull request? 1, Add python example for OneVsRest 2, remove args-parsing ## How was this patch tested? manual tests `./bin/spark-submit examples/src/main/python/ml/one_vs_rest_example.py` Author: Zheng RuiFeng <ruifengz@foxmail.com> Closes #12920 from zhengruifeng/ovr_pe. (cherry picked from commit ad1a846) Signed-off-by: Nick Pentreath <nickp@za.ibm.com>
What changes were proposed in this pull request?
1, Add python example for OneVsRest
2, remove args-parsing
How was this patch tested?
manual tests
./bin/spark-submit examples/src/main/python/ml/one_vs_rest_example.py