-
Notifications
You must be signed in to change notification settings - Fork 615
Multivariate r2 #1310
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
Multivariate r2 #1310
Conversation
You are owner of some files modified in this pull request. |
This PR is incomplete, though. It is really just an idea proposal, so please don't merge before we work out the details. |
Thanks a lot @harahu for this pull request. Mutiple things come to mind:
|
Thank you for your thoughts on this @gabrieldemarmiesse! I definitely agree that there should be a high threshold for breaking with the 'scikit-learn' behaviour. I did ask a question regarding this on Cross Validated, hoping to get some feedback. I really am no expert myself. |
Did not get much response on Cross Validated, but I did discuss this with my colleague @ttvand . The only generalization of R2 we felt comfortable claiming made sense was where you calculate individual scores per label element. This corresponds with the Any further feedback on this, @gabrieldemarmiesse ? |
I believe you made the right call here. We don't need to think about it too much if we just copy what scikit learn does and make tests to ensure the results are the same for the three values. Users will pick whatever they want from what is available. I think that's perfect and it also has the nice property that we (I) don't need to check the math to merge since scikit-learn does it for us (the review is going to be much faster). Give me some time to review on the technical side of things. Thanks again for all your work! |
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.
Everything is good. Just some style remarks to adress to try to improve readability and we're good to merge this!
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.
Perfect, thanks a lot!
* Proposal for multivariate r2 * More flavours of multioutput * Improve an unfinished exception message * Simplifications to increase readability * Pass some arguments that should be passed
I noticed that the
RSquared
metric does not behave in the same way as thescikit-learn
implementation of the same metric for multivariate regression (inscikit-learn
known as "multioutput"). First I thought I should mend it to align with thescikit-learn
implementation that calculates separate scores for each label element and aggregates the scores. Then I started asking myself whether there might be other ways of interpreting R2 in higher dimensions. Looking at the definition presented in https://en.wikipedia.org/wiki/Coefficient_of_determination, it does look like it might make sense to extend it to higher rank data types, but this can be done in different ways, and I am unsure what would make sense mathematically. Thescikit-learn
approach at least makes some sense to me as it just treats the model as a model for n separate dependent variables at the same time.I would really like a discussion on how R2 should be understood in higher dimensions, but if we are to go with the
scikit-learn
interpretation, this PR is one way to go about it. It is slightly annoying that you have to specify the shape of y when initializing the metric object. This could be solved by dynamically setting the shape like it is done in the MeanTensor metric. Although more user friendly, I don't think the code is as clean, so there is a trade-off.I modified a test to show how this acts for higher dimensional data, currently matching the
multioutput="raw_values"
flavour of thescikit-learn
implementation.