Skip to content
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

Add Julia implementation of r2_score #285

Merged
merged 22 commits into from
Jul 26, 2023
Merged

Add Julia implementation of r2_score #285

merged 22 commits into from
Jul 26, 2023

Conversation

sethaxen
Copy link
Member

This PR implements r2_score in Julia.

Computationally, the implementation is equivalent to Python's. However, it has a few extra convenience features:

  • It takes output (draws[, chains], noutputs) for consistency with our other methods.
  • It produces the output as a NamedTuple, similar to ess_rhat
  • Similar to loo_pit, it has a method that takes an InferenceData, attempts to find the y and y_pred data in it, and then permutes dims as required by the default r2_score method.

@ahartikainen
Copy link

I know y and y_pred are magic, but I wonder if it should try to pair first variables (with or without _pred) in posterior and posterior_predictive groups, and then any xxx <--> xxx_pred

@sethaxen sethaxen marked this pull request as ready for review July 26, 2023 13:18
@sethaxen
Copy link
Member Author

I know y and y_pred are magic, but I wonder if it should try to pair first variables (with or without _pred) in posterior and posterior_predictive groups, and then any xxx <--> xxx_pred

I implemented this in a new utility function observations_and_predictions, which is now used by both loo_pit and r2_score.

@sethaxen sethaxen merged commit 63d3cac into main Jul 26, 2023
10 of 12 checks passed
@sethaxen sethaxen deleted the r2_score branch July 26, 2023 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants