Skip to content

Commit

Permalink
Fewer snapshots in testing (#72)
Browse files Browse the repository at this point in the history
* use saved objects instead of snapshots for #71

* use saved objects instead of snapshots

* rlang version requirement

* use saved objects instead of snapshots, binary mlp edition

* use saved objects instead of snapshots, mulitclass mlp edition

* use saved objects instead of snapshots, regression mlp edition

* try testing on other OS

* updated multinom snapshot

* regenerate test objects based on changes from #70

* remove model print snapshots since they are not reproducible

* try running on all os

* add back skip for apple silicon

* update skips

* more skip updates
  • Loading branch information
topepo authored Nov 3, 2023
1 parent 7f7a421 commit ec4756c
Show file tree
Hide file tree
Showing 33 changed files with 965 additions and 939 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ Imports:
ggplot2,
glue,
hardhat,
rlang,
rlang (>= 1.1.1),
stats,
tibble,
torch (>= 0.6.0),
torch (>= 0.11.0),
utils
Suggests:
covr,
Expand Down
59 changes: 0 additions & 59 deletions tests/testthat/_snaps/logistic_reg-fit.md

This file was deleted.

91 changes: 0 additions & 91 deletions tests/testthat/_snaps/mlp-binary.md

This file was deleted.

70 changes: 0 additions & 70 deletions tests/testthat/_snaps/mlp-multinomial.md

This file was deleted.

16 changes: 0 additions & 16 deletions tests/testthat/_snaps/mlp-regression.md

This file was deleted.

59 changes: 0 additions & 59 deletions tests/testthat/_snaps/multinomial_reg-fit.md

This file was deleted.

27 changes: 27 additions & 0 deletions tests/testthat/helper-save-objects.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
last_param <- function(x) {
last_epoch <- length(x$loss)
coef(x, epoch = last_epoch)
}

save_coef <- function(x) {
cl <- match.call()
nm <- as.character(cl$x)
fl <- file.path("saved", paste0(nm, ".rds"))
if (file.exists(fl)) {
return(FALSE)
}
res <- last_param(x)
saveRDS(res, file = fl)
invisible(TRUE)
}

load_coef <- function(x) {
cl <- match.call()
nm <- as.character(cl$x)
fl <- file.path("saved", paste0(nm, ".rds"))
if (!file.exists(fl)) {
rlang::abort(paste("Can't find test results:", fl))
}
readRDS(fl)
}

Binary file added tests/testthat/saved/lin_reg_fit_lbfgs.rds
Binary file not shown.
Binary file added tests/testthat/saved/lin_reg_fit_sgd.rds
Binary file not shown.
Binary file added tests/testthat/saved/logistic_reg_fit_lbfgs.rds
Binary file not shown.
Binary file added tests/testthat/saved/logistic_reg_fit_lbfgs_wts.rds
Binary file not shown.
Binary file added tests/testthat/saved/logistic_reg_fit_sgd.rds
Binary file not shown.
Binary file added tests/testthat/saved/logistic_reg_fit_sgd_wts.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_bin_lbfgs_fit_12.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_bin_lbfgs_fit_20.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_bin_mat_lbfgs_fit.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_bin_sgd_fit.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_bin_sgd_fit_12.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_bin_sgd_fit_20.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_mlt_mat_lbfgs_fit.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_reg_mat_lbfgs_fit.rds
Binary file not shown.
Binary file added tests/testthat/saved/mlp_reg_rec_lbfgs_fit.rds
Binary file not shown.
Binary file added tests/testthat/saved/multinom_fit_lbfgs.rds
Binary file not shown.
Binary file added tests/testthat/saved/multinom_fit_lbfgs_wts_12.rds
Binary file not shown.
Binary file added tests/testthat/saved/multinom_fit_sgd.rds
Binary file not shown.
Binary file added tests/testthat/saved/multinom_fit_sgd_wts_20.rds
Binary file not shown.
Loading

0 comments on commit ec4756c

Please sign in to comment.