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

Try to get more info on failure #285

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,3 @@ jobs:
with:
upload-snapshots: true
error-on: '"note"'

# fail-fast but only if rcmdcheck step fails
- name: Manual fail-fast
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: always() && steps.rcmdcheck.outcome == 'failure'
run: gh run cancel ${{ github.run_id }}
4 changes: 2 additions & 2 deletions R/extract_param.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ extract_param <- function(type = c("percentiles", "range"),
if (distribution == "norm") {
checkmate::assert_numeric(values)
} else {
checkmate::assert_numeric(values, lower = 1e-10)
checkmate::assert_numeric(values, lower = 0)
}

if (type == "percentiles") {
Expand Down Expand Up @@ -221,7 +221,7 @@ extract_param <- function(type = c("percentiles", "range"),
}
if (distribution == "weibull") {
names(param) <- c("shape", "scale")
lower <- c(1e-10, 1e-10)
lower <- c(1e-5, 1e-5)
}
if (distribution == "norm") {
names(param) <- c("mean", "sd")
Expand Down
156 changes: 85 additions & 71 deletions vignettes/extract-bias.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -206,47 +206,54 @@
for (params_idx in seq_len(nrow(parameters_range))) {
dist <- as.character(parameters_range[params_idx, "dist"])
n_samples <- parameters_range[params_idx, "n_samples"]

if (dist == "lnorm") {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]

Check warning on line 209 in vignettes/extract-bias.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/extract-bias.Rmd,line=209,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
# while loop to ensure values are min < median < max
resample_values <- TRUE
while (resample_values) {
if (dist == "lnorm") {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- c(min(true_range), max(true_range))
} else {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
true_range <- c(min(true_range), max(true_range))
} else {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- c(min(true_range), max(true_range))
true_range <- c(min(true_range), max(true_range))
}

Check warning on line 250 in vignettes/extract-bias.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/extract-bias.Rmd,line=250,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
true_values <- c(true_median, true_range)
if (true_values[2] < true_values[1] && true_values[1] < true_values[3]) {
resample_values <- FALSE
}
}

true_values <- c(true_median, true_range)


Check warning on line 256 in vignettes/extract-bias.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/extract-bias.Rmd,line=256,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
# message about stochastic optimisation suppressed
estim_params[[params_idx]] <- suppressMessages(
expr = extract_param(
Expand Down Expand Up @@ -393,46 +400,53 @@
dist <- as.character(parameters_range[params_idx, "dist"])
n_samples <- parameters_range[params_idx, "n_samples"]

if (dist == "lnorm") {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]
# while loop to ensure values are min < median < max
resample_values <- TRUE
while (resample_values) {
if (dist == "lnorm") {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
meanlog = parameters_range[params_idx, "param_1"],
sdlog = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- c(min(true_range), max(true_range))
} else {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
true_range <- c(min(true_range), max(true_range))
} else {
true_median <- do.call(
paste0("q", dist),
list(
p = 0.5,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
true_range <- do.call(
paste0("r", dist),
list(
n = n_samples,
shape = parameters_range[params_idx, "param_1"],
scale = parameters_range[params_idx, "param_2"]
)
)
)
true_range <- c(min(true_range), max(true_range))
true_range <- c(min(true_range), max(true_range))
}

Check warning on line 443 in vignettes/extract-bias.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/extract-bias.Rmd,line=443,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
true_values <- c(true_median, true_range)
if (true_values[2] < true_values[1] && true_values[1] < true_values[3]) {
resample_values <- FALSE
}
}

true_values <- c(true_median, true_range)


Check warning on line 449 in vignettes/extract-bias.Rmd

View workflow job for this annotation

GitHub Actions / lint-changed-files

file=vignettes/extract-bias.Rmd,line=449,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.
# message about stochastic optimisation suppressed
estim <- suppressMessages(
replicate(
Expand Down
Loading