Uh oh!
There was an error while loading. Please reload this page.
[SPARK-16831] [Python] Fixed bug in CrossValidator.avgMetrics - #14456
[SPARK-16831] [Python] Fixed bug in CrossValidator.avgMetrics#14456pkch wants to merge 3 commits into
Conversation
| # TODO: duplicate evaluator to take extra params from input | ||
| metric = eva.evaluate(model.transform(validation, epm[j])) | ||
| metrics[j] += metric | ||
| metrics[j] += metric/nFolds |
There was a problem hiding this comment.
This may fail style checks but we'll see
There was a problem hiding this comment.
OK looks fine actually. Would it be possible to add a little bit to the test above this to demonstrate that the result is correct now? just testing the value of the first element of metrics for example.
There was a problem hiding this comment.
Done (2 commits because I made a typo.)
srowen
commented
Aug 2, 2016
Jenkins add to whitelist |
srowen
commented
Aug 2, 2016
Jenkins test this please |
SparkQA
commented
Aug 2, 2016
Test build #63122 has finished for PR 14456 at commit
|
SparkQA
commented
Aug 3, 2016
Test build #63157 has finished for PR 14456 at commit
|
SparkQA
commented
Aug 3, 2016
Test build #63158 has finished for PR 14456 at commit
|
| >>> cv = CrossValidator(estimator=lr, estimatorParamMaps=grid, evaluator=evaluator) | ||
| >>> cvModel = cv.fit(dataset) | ||
| >>> cvModel.avgMetrics[0] | ||
| 0.5 |
There was a problem hiding this comment.
Nice, I assume this would have printed 1.5 before
srowen
commented
Aug 3, 2016
Merge to master/2.0/1.6 |
avgMetrics was summed, not averaged, across folds Author: =^_^= <maxmoroz@gmail.com> Closesapache#14456 from pkch/pkch-patch-1. (cherry picked from commit 639df04) Signed-off-by: Sean Owen <sowen@cloudera.com> (cherry picked from commit 92ee6fb)
yhuai
commented
Aug 11, 2016
Sorry. I think this pr breaks 1.6 build. |
srowen
commented
Aug 11, 2016
Oh dear. I give up on back-porting things to 1.6. It just breaks too much at this stage! I will revert. |
yhuai
commented
Aug 11, 2016
Thanks! Seems #12464 introduced avgMetrics to CrossValidator model. |
gtolomei
commented
Apr 23, 2020
Hi everyone, I know this thread is closed and the bug on how Basically, I have setup a Everything seems to run smoothly, except for the fact that when I'm printing out the performance (i.e., RMSE) of each model (i.e., 9 models for each fold) and I try to "manually" compute the average from each fold, the resulting 9 average values do not match at all with the values I get when I use the internal As you can see, all the values of RMSE are below 150,000. There are 9 elements as expected but none of them looks correct! In fact, all of them are above 150,000 even though none of my 45 models (not only the 5 I listed above) reaches those figures. It looks like the way in which I have also tried to inspect the current implementation of the Interestingly enough, the same happens even if I run k-fold cross validation on Has anyone else experienced the same issue? Many thanks, any help will be much appreciated! NOTE: I have blindly assumed the problem (if any) is on the |
srowen
commented
Apr 23, 2020
That's weird, I also don't see how it can happen. How did you print the metrics above, just by adding logging statements to spark? just wondering if it's at all possible they're from something else. I tried this locally with a simple setup like yours (different data) and the avgMetrics reports the average of the model across folds exactly. |
gtolomei
commented
Apr 23, 2020
Thanks for your reply Sean! My setting is as follows: I'm running PySpark 2.4.5 remotely over Google Colab. I call the above function as follows: where Thanks again for your help! |
srowen
commented
Apr 23, 2020
Oh, you're printing from the training summary. That's RMSE on the training set. The eval metric is the (average of) RMSE on the held-out folds. The result makes sense. |
gtolomei
commented
Apr 23, 2020
Ohhh... I got it, thanks! Thanks a lot! |
srowen
commented
Apr 23, 2020
I don't see that is recorded anywhere. I verified the avg was right just by hacking the code to print them. |
gtolomei
commented
Apr 23, 2020
Gotcha! Thanks again for your help! |
What changes were proposed in this pull request?
avgMetrics was summed, not averaged, across folds