Skip to content

242 quantile renaming #243

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

Merged
merged 11 commits into from
Oct 6, 2023
Merged

242 quantile renaming #243

merged 11 commits into from
Oct 6, 2023

Conversation

dajmcdon
Copy link
Contributor

@dajmcdon dajmcdon commented Oct 1, 2023

closes #242

@dajmcdon dajmcdon requested a review from dsweber2 October 1, 2023 20:04
@dshemetov
Copy link
Contributor

dshemetov commented Oct 2, 2023

Our meeting notes say we were going to use the term quantile_level. Want to make sure that we're consciously switching to quantile_value instead. I think level better evokes the fixed values of a categorical variable. I do wish there was a more standardized term for the thing we're talking about here, but other packages (like numpy) don't offer better solutions.

@dsweber2
Copy link
Contributor

dsweber2 commented Oct 2, 2023

let's see, the variables that were renamed were:

The search I ended up using for the single letters was [^a-zA-Z_\-0-9]p[^a-zA-Z_\-0-9], which I think gets rid of all the places that p can be part of another word or variable?

@dajmcdon
Copy link
Contributor Author

dajmcdon commented Oct 2, 2023

Hmmm, nuts. That's not what I listed in #242. But my memory is hazy. Does quantile_level sound right to the rest of you?

@dsweber2
Copy link
Contributor

dsweber2 commented Oct 2, 2023

I think that having both values and quantile_values is kind of confusing; I don't remember what we said in the meeting but quantile_levels seems less likely to get clobbered when I'm working quickly.

@dajmcdon
Copy link
Contributor Author

dajmcdon commented Oct 2, 2023

I think some of these actually have to stay.

  • levels this is referring to levels of a factor.
  • tau these are the underlying arguments of functions from other packages. This syntax actually maps our new names for these things to those arguments. So these stay.
  • q I think these are all local. I'm happy to try to change them, but I don't think it will matter.
  • p These are a bit stupid. In multiple cases, I used partial argument matching. The generic quantile() function takes probs as an argument. So I left probs as an arg to extrapolate_quantiles() which is basically trying to take quantiles of a dist_quantiles object. But you can match the argument as quantile(x, p = z) which internally becomes quantile(x, probs = z). This is probably not optimal coding practice. I'll try to fix these.

@dsweber2
Copy link
Contributor

dsweber2 commented Oct 2, 2023

  • good to know, I just wanted to confirm for both the levels and the tau
  • it might be good for consistency's sake to rename the q's, but I don't have strong feelings
  • oh right, partial matching. Thanks for ditching those, they keep causing spurious warnings. Definitely an R footgun imo

@dajmcdon
Copy link
Contributor Author

dajmcdon commented Oct 2, 2023

Ok. I think I fixed all the quantile_values -> quantile_levels.

I was wrong about p being a partial match. In the {distributional} package that we Import for this purpose, it actually defines the quantile method as quantile(x, p, ...) rather than quantile(x, probs, ...). So we're stuck with that one.

@dshemetov
Copy link
Contributor

Ask distributional maintainer to switch the naming?

This was referenced Oct 4, 2023
@nmdefries nmdefries mentioned this pull request Oct 4, 2023
@dsweber2 dsweber2 mentioned this pull request Oct 4, 2023
Copy link
Contributor

@nmdefries nmdefries left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a couple vars in dist_quantiles.R that may need to be updated, I couldn't tell if David's previous comments addressed these.

~ distributional::parameters(.x) %>%
tidyr::unnest(tidyselect::everything()) %>%
mutate(values = unname(values))
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does tau_out need to be changed too, e.g. tail_extrapolate line 277?

Also a lot of probs here in extrapolate_quantiles and variants.

p and q used as args for functions starting on line 87, in exp_q_par, exp_tail_q, qlaplace, norm_q_par, norm_tail_q. (Searched using regex [^_a-zA-Z0-9]p[^_a-zA-Z0-9]).

dsweber2 and others added 3 commits October 5, 2023 11:58
Merge branch 'v0.0.6' into 242-quantile-renaming

# Conflicts:
#	R/dist_quantiles.R
#	R/epipredict-package.R
#	R/layer_residual_quantiles.R
#	man/arx_fcast_epi_workflow.Rd
#	man/arx_forecaster.Rd
#	man/extrapolate_quantiles.Rd
#	man/nested_quantiles.Rd
#	man/smooth_quantile_reg.Rd
@dajmcdon dajmcdon merged commit dacf6e7 into v0.0.6 Oct 6, 2023
@dajmcdon dajmcdon deleted the 242-quantile-renaming branch October 6, 2023 00:07
@dshemetov dshemetov mentioned this pull request Oct 6, 2023
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.

4 participants