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

I have added user-defined thresholds based on #49 #52

Merged
merged 6 commits into from
Aug 13, 2024

Conversation

clemasso
Copy link
Contributor

No description provided.

Copy link
Collaborator

@TanguyBarthelemy TanguyBarthelemy left a comment

Choose a reason for hiding this comment

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

This PR is okay for me. It is functional. We can discuss small details in the future (in particular my comments in the review).

Comment on lines +12 to +65

# options initialization
if (is.null(getOption("theil_u1_threshold"))) {
set_thresholds_to_default("theil_u1_threshold")
}
if (is.null(getOption("theil_u2_threshold"))) {
set_thresholds_to_default("theil_u2_threshold")
}
if (is.null(getOption("t_threshold"))) {
set_thresholds_to_default("t_threshold")
}
if (is.null(getOption("augmented_t_threshold"))) {
set_thresholds_to_default("augmented_t_threshold")
}
if (is.null(getOption("slope_and_drift_threshold"))) {
set_thresholds_to_default("slope_and_drift_threshold")
}
if (is.null(getOption("eff1_threshold"))) {
set_thresholds_to_default("eff1_threshold")
}
if (is.null(getOption("eff2_threshold"))) {
set_thresholds_to_default("eff2_threshold")
}
if (is.null(getOption("orth1_threshold"))) {
set_thresholds_to_default("orth1_threshold")
}
if (is.null(getOption("orth2_threshold"))) {
set_thresholds_to_default("orth2_threshold")
}
if (is.null(getOption("autocorr_threshold"))) {
set_thresholds_to_default("autocorr_threshold")
}
if (is.null(getOption("seas_threshold"))) {
set_thresholds_to_default("seas_threshold")
}
if (is.null(getOption("signal_noise1_threshold"))) {
set_thresholds_to_default("signal_noise1_threshold")
}
if (is.null(getOption("signal_noise2_threshold"))) {
set_thresholds_to_default("signal_noise2_threshold")
}

if (is.null(getOption("jb_res_threshold"))) {
set_thresholds_to_default("jb_res_threshold")
}
if (is.null(getOption("bp_res_threshold"))) {
set_thresholds_to_default("bp_res_threshold")
}
if (is.null(getOption("white_res_threshold"))) {
set_thresholds_to_default("white_res_threshold")
}
if (is.null(getOption("arch_res_threshold"))) {
set_thresholds_to_default("arch_res_threshold")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not initialise all the options when the package is loaded?

Comment on lines 107 to 109
#' options(list(augmented_t_threshold = c(severe = 0.005, bad = 0.01, uncertain = 0.05),
#' slope_and_drift_threshold = c(severe = 0.005, bad = 0.05, uncertain = 0.10),
#' theil_u2_threshold = c(uncertain = .5, bad = .7, severe = 1)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

options(list(...))) <=> options(...)

thr = quality_thresholds$slope_and_drift,
thr_res = quality_thresholds_res)
thr = getOption("slope_and_drift_threshold"),
thr_res = res_thresholds)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should detail each threshold individually. This will make it easier for the user to set thresholds individually.

For example:

instead of:

res_thresholds <- list(
    jb = getOption("jb_res_threshold"),
    bp = getOption("bp_res_threshold"),
    white = getOption("white_res_threshold"),
    arch = getOption("arch_res_threshold")
)
 sd_test_evaluator(..., thr_res = res_thresholds)

You can write:

res_thresholds <- list(
    jb = getOption("jb_res_threshold"),
    bp = getOption("bp_res_threshold"),
    white = getOption("white_res_threshold"),
    arch = getOption("arch_res_threshold")
)
 sd_test_evaluator(..., 
    jb = getOption("jb_res_threshold"),
    bp = getOption("bp_res_threshold"),
    white = getOption("white_res_threshold"),
    arch = getOption("arch_res_threshold")
)

Maybe the best is to add an argument ... to eval_test() instead of threshold.

@clemasso clemasso merged commit 4088a6b into rjdverse:develop Aug 13, 2024
7 of 8 checks passed
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