Skip to content

Commit 46e49f3

Browse files
committed
Updated regression tests
1 parent e8978b6 commit 46e49f3

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

tools/regression/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Regression Testing for BART and BCF
2+
3+
This directory contains scripts that constitute a lowkey "regression testing" procedure for `stochtree`'s BART and BCF models. The goal is to ensure that the models are functioning correctly and that any changes made to the code do not introduce new bugs.
4+
5+
## Overview
6+
7+
`stochtree` is by its nature a stochastic software tool, meaning that it generates different results each time it is run. This complicates regression testing slightly, as we cannot always distinguish between a genuine performance regression and an expected variation in results.
8+
9+
For this reason, the "regression testing" setup is somewhat informal. It is designed to catch any strinkingly obvious issues. Both BART and BCF are run on a set of example datasets, and the results can then be compared against previously saved outputs.
10+
11+
## Usage
12+
13+
### R Package
14+
15+
To run the regression tests for the R package, first navigate to the `stochtree` repository in your terminal and then run:
16+
17+
```bash
18+
Rscript tools/regression/bart/regression_test_dispatch_bart.R
19+
Rscript tools/regression/bcf/regression_test_dispatch_bcf.R
20+
```
21+
22+
Then, to combine and analyze the results, run:
23+
24+
```bash
25+
Rscript tools/regression/bart/regression_test_analysis_bart.R
26+
Rscript tools/regression/bcf/regression_test_analysis_bcf.R
27+
```
28+
29+
This can be compared against any previously saved results. We are currently figuring out a solution for hosting previous regression results, so for now, you will need to manually save and compare outputs of the tests locally before and after after making your changes.

tools/regression/bcf/regression_test_analysis_bcf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ for (file in reg_test_files) {
88
}
99

1010
summary_df <- aggregate(
11-
cbind(rmse, coverage, runtime) ~ n + p + num_gfr + num_mcmc + dgp_num + snr + test_set_pct + num_threads,
11+
cbind(outcome_rmse, outcome_coverage, treatment_effect_rmse, treatment_effect_coverage, runtime) ~ n + p + num_gfr + num_mcmc + dgp_num + snr + test_set_pct + num_threads,
1212
data = reg_test_df, FUN = median, drop = TRUE
1313
)
1414

0 commit comments

Comments
 (0)