Skip to content

Commit 0ed9a12

Browse files
committed
Change mu to "prognostic" and tau to "treatment effect" in the code
1 parent 3559956 commit 0ed9a12

9 files changed

+64
-64
lines changed

R/bcf.R

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
#' - `num_chains` How many independent MCMC chains should be sampled. If `num_mcmc = 0`, this is ignored. If `num_gfr = 0`, then each chain is run from root for `num_mcmc * keep_every + num_burnin` iterations, with `num_mcmc` samples retained. If `num_gfr > 0`, each MCMC chain will be initialized from a separate GFR ensemble, with the requirement that `num_gfr >= num_chains`. Default: `1`.
4848
#' - `verbose` Whether or not to print progress during the sampling loops. Default: `FALSE`.
4949
#'
50-
#' @param mu_forest_params (Optional) A list of prognostic forest model parameters, each of which has a default value processed internally, so this argument list is optional.
50+
#' @param prognostic_forest_params (Optional) A list of prognostic forest model parameters, each of which has a default value processed internally, so this argument list is optional.
5151
#'
5252
#' - `num_trees` Number of trees in the ensemble for the prognostic forest. Default: `250`. Must be a positive integer.
5353
#' - `alpha` Prior probability of splitting for a tree of depth 0 in the prognostic forest. Tree split prior combines `alpha` and `beta` via `alpha*(1+node_depth)^-beta`. Default: `0.95`.
@@ -62,7 +62,7 @@
6262
#' - `keep_vars` Vector of variable names or column indices denoting variables that should be included in the forest. Default: `NULL`.
6363
#' - `drop_vars` Vector of variable names or column indices denoting variables that should be excluded from the forest. Default: `NULL`. If both `drop_vars` and `keep_vars` are set, `drop_vars` will be ignored.
6464
#'
65-
#' @param tau_forest_params (Optional) A list of treatment effect forest model parameters, each of which has a default value processed internally, so this argument list is optional.
65+
#' @param treatment_effect_forest_params (Optional) A list of treatment effect forest model parameters, each of which has a default value processed internally, so this argument list is optional.
6666
#'
6767
#' - `num_trees` Number of trees in the ensemble for the treatment effect forest. Default: `50`. Must be a positive integer.
6868
#' - `alpha` Prior probability of splitting for a tree of depth 0 in the treatment effect forest. Tree split prior combines `alpha` and `beta` via `alpha*(1+node_depth)^-beta`. Default: `0.25`.
@@ -145,8 +145,8 @@ bcf <- function(X_train, Z_train, y_train, propensity_train = NULL, rfx_group_id
145145
rfx_group_ids_test = NULL, rfx_basis_test = NULL,
146146
num_gfr = 5, num_burnin = 0, num_mcmc = 100,
147147
previous_model_json = NULL, previous_model_warmstart_sample_num = NULL,
148-
general_params = list(), mu_forest_params = list(),
149-
tau_forest_params = list(), variance_forest_params = list()) {
148+
general_params = list(), prognostic_forest_params = list(),
149+
treatment_effect_forest_params = list(), variance_forest_params = list()) {
150150
# Update general BCF parameters
151151
general_params_default <- list(
152152
cutpoint_grid_size = 100, standardize = TRUE,
@@ -163,27 +163,27 @@ bcf <- function(X_train, Z_train, y_train, propensity_train = NULL, rfx_group_id
163163
)
164164

165165
# Update mu forest BCF parameters
166-
mu_forest_params_default <- list(
166+
prognostic_forest_params_default <- list(
167167
num_trees = 250, alpha = 0.95, beta = 2.0,
168168
min_samples_leaf = 5, max_depth = 10,
169169
sample_sigma2_leaf = TRUE, sigma2_leaf_init = NULL,
170170
sigma2_leaf_shape = 3, sigma2_leaf_scale = NULL,
171171
keep_vars = NULL, drop_vars = NULL
172172
)
173-
mu_forest_params_updated <- preprocessParams(
174-
mu_forest_params_default, mu_forest_params
173+
prognostic_forest_params_updated <- preprocessParams(
174+
prognostic_forest_params_default, prognostic_forest_params
175175
)
176176

177177
# Update tau forest BCF parameters
178-
tau_forest_params_default <- list(
178+
treatment_effect_forest_params_default <- list(
179179
num_trees = 50, alpha = 0.25, beta = 3.0,
180180
min_samples_leaf = 5, max_depth = 5,
181181
sample_sigma2_leaf = FALSE, sigma2_leaf_init = NULL,
182182
sigma2_leaf_shape = 3, sigma2_leaf_scale = NULL,
183183
keep_vars = NULL, drop_vars = NULL
184184
)
185-
tau_forest_params_updated <- preprocessParams(
186-
tau_forest_params_default, tau_forest_params
185+
treatment_effect_forest_params_updated <- preprocessParams(
186+
treatment_effect_forest_params_default, treatment_effect_forest_params
187187
)
188188

189189
# Update variance forest BCF parameters
@@ -222,30 +222,30 @@ bcf <- function(X_train, Z_train, y_train, propensity_train = NULL, rfx_group_id
222222
verbose <- general_params_updated$verbose
223223

224224
# 2. Mu forest parameters
225-
num_trees_mu <- mu_forest_params_updated$num_trees
226-
alpha_mu <- mu_forest_params_updated$alpha
227-
beta_mu <- mu_forest_params_updated$beta
228-
min_samples_leaf_mu <- mu_forest_params_updated$min_samples_leaf
229-
max_depth_mu <- mu_forest_params_updated$max_depth
230-
sample_sigma_leaf_mu <- mu_forest_params_updated$sample_sigma2_leaf
231-
sigma_leaf_mu <- mu_forest_params_updated$sigma2_leaf_init
232-
a_leaf_mu <- mu_forest_params_updated$sigma2_leaf_shape
233-
b_leaf_mu <- mu_forest_params_updated$sigma2_leaf_scale
234-
keep_vars_mu <- mu_forest_params_updated$keep_vars
235-
drop_vars_mu <- mu_forest_params_updated$drop_vars
225+
num_trees_mu <- prognostic_forest_params_updated$num_trees
226+
alpha_mu <- prognostic_forest_params_updated$alpha
227+
beta_mu <- prognostic_forest_params_updated$beta
228+
min_samples_leaf_mu <- prognostic_forest_params_updated$min_samples_leaf
229+
max_depth_mu <- prognostic_forest_params_updated$max_depth
230+
sample_sigma_leaf_mu <- prognostic_forest_params_updated$sample_sigma2_leaf
231+
sigma_leaf_mu <- prognostic_forest_params_updated$sigma2_leaf_init
232+
a_leaf_mu <- prognostic_forest_params_updated$sigma2_leaf_shape
233+
b_leaf_mu <- prognostic_forest_params_updated$sigma2_leaf_scale
234+
keep_vars_mu <- prognostic_forest_params_updated$keep_vars
235+
drop_vars_mu <- prognostic_forest_params_updated$drop_vars
236236

237237
# 3. Tau forest parameters
238-
num_trees_tau <- tau_forest_params_updated$num_trees
239-
alpha_tau <- tau_forest_params_updated$alpha
240-
beta_tau <- tau_forest_params_updated$beta
241-
min_samples_leaf_tau <- tau_forest_params_updated$min_samples_leaf
242-
max_depth_tau <- tau_forest_params_updated$max_depth
243-
sample_sigma_leaf_tau <- tau_forest_params_updated$sample_sigma2_leaf
244-
sigma_leaf_tau <- tau_forest_params_updated$sigma2_leaf_init
245-
a_leaf_tau <- tau_forest_params_updated$sigma2_leaf_shape
246-
b_leaf_tau <- tau_forest_params_updated$sigma2_leaf_scale
247-
keep_vars_tau <- tau_forest_params_updated$keep_vars
248-
drop_vars_tau <- tau_forest_params_updated$drop_vars
238+
num_trees_tau <- treatment_effect_forest_params_updated$num_trees
239+
alpha_tau <- treatment_effect_forest_params_updated$alpha
240+
beta_tau <- treatment_effect_forest_params_updated$beta
241+
min_samples_leaf_tau <- treatment_effect_forest_params_updated$min_samples_leaf
242+
max_depth_tau <- treatment_effect_forest_params_updated$max_depth
243+
sample_sigma_leaf_tau <- treatment_effect_forest_params_updated$sample_sigma2_leaf
244+
sigma_leaf_tau <- treatment_effect_forest_params_updated$sigma2_leaf_init
245+
a_leaf_tau <- treatment_effect_forest_params_updated$sigma2_leaf_shape
246+
b_leaf_tau <- treatment_effect_forest_params_updated$sigma2_leaf_scale
247+
keep_vars_tau <- treatment_effect_forest_params_updated$keep_vars
248+
drop_vars_tau <- treatment_effect_forest_params_updated$drop_vars
249249

250250
# 4. Variance forest parameters
251251
num_trees_variance <- variance_forest_params_updated$num_trees
@@ -1627,8 +1627,8 @@ predict.bcfmodel <- function(object, X, Z, propensity = NULL, rfx_group_ids = NU
16271627
#' rfx_group_ids_test = rfx_group_ids_test,
16281628
#' rfx_basis_test = rfx_basis_test,
16291629
#' num_gfr = 10, num_burnin = 0, num_mcmc = 10,
1630-
#' mu_forest_params = mu_params,
1631-
#' tau_forest_params = tau_params)
1630+
#' prognostic_forest_params = mu_params,
1631+
#' treatment_effect_forest_params = tau_params)
16321632
#' rfx_samples <- getRandomEffectSamples(bcf_model)
16331633
getRandomEffectSamples.bcfmodel <- function(object, ...){
16341634
result = list()
@@ -1720,8 +1720,8 @@ getRandomEffectSamples.bcfmodel <- function(object, ...){
17201720
#' rfx_group_ids_test = rfx_group_ids_test,
17211721
#' rfx_basis_test = rfx_basis_test,
17221722
#' num_gfr = 10, num_burnin = 0, num_mcmc = 10,
1723-
#' mu_forest_params = mu_params,
1724-
#' tau_forest_params = tau_params)
1723+
#' prognostic_forest_params = mu_params,
1724+
#' treatment_effect_forest_params = tau_params)
17251725
#' bcf_json <- saveBCFModelToJson(bcf_model)
17261726
saveBCFModelToJson <- function(object){
17271727
jsonobj <- createCppJson()
@@ -1887,8 +1887,8 @@ saveBCFModelToJson <- function(object){
18871887
#' rfx_group_ids_test = rfx_group_ids_test,
18881888
#' rfx_basis_test = rfx_basis_test,
18891889
#' num_gfr = 10, num_burnin = 0, num_mcmc = 10,
1890-
#' mu_forest_params = mu_params,
1891-
#' tau_forest_params = tau_params)
1890+
#' prognostic_forest_params = mu_params,
1891+
#' treatment_effect_forest_params = tau_params)
18921892
#' saveBCFModelToJsonFile(bcf_model, "test.json")
18931893
saveBCFModelToJsonFile <- function(object, filename){
18941894
# Convert to Json
@@ -1967,8 +1967,8 @@ saveBCFModelToJsonFile <- function(object, filename){
19671967
#' rfx_group_ids_test = rfx_group_ids_test,
19681968
#' rfx_basis_test = rfx_basis_test,
19691969
#' num_gfr = 10, num_burnin = 0, num_mcmc = 10,
1970-
#' mu_forest_params = mu_params,
1971-
#' tau_forest_params = tau_params)
1970+
#' prognostic_forest_params = mu_params,
1971+
#' treatment_effect_forest_params = tau_params)
19721972
#' saveBCFModelToJsonString(bcf_model)
19731973
saveBCFModelToJsonString <- function(object){
19741974
# Convert to Json
@@ -2049,8 +2049,8 @@ saveBCFModelToJsonString <- function(object){
20492049
#' rfx_group_ids_test = rfx_group_ids_test,
20502050
#' rfx_basis_test = rfx_basis_test,
20512051
#' num_gfr = 10, num_burnin = 0, num_mcmc = 10,
2052-
#' mu_forest_params = mu_params,
2053-
#' tau_forest_params = tau_params)
2052+
#' prognostic_forest_params = mu_params,
2053+
#' treatment_effect_forest_params = tau_params)
20542054
#' bcf_json <- saveBCFModelToJson(bcf_model)
20552055
#' bcf_model_roundtrip <- createBCFModelFromJson(bcf_json)
20562056
createBCFModelFromJson <- function(json_object){
@@ -2216,8 +2216,8 @@ createBCFModelFromJson <- function(json_object){
22162216
#' rfx_group_ids_test = rfx_group_ids_test,
22172217
#' rfx_basis_test = rfx_basis_test,
22182218
#' num_gfr = 10, num_burnin = 0, num_mcmc = 10,
2219-
#' mu_forest_params = mu_params,
2220-
#' tau_forest_params = tau_params)
2219+
#' prognostic_forest_params = mu_params,
2220+
#' treatment_effect_forest_params = tau_params)
22212221
#' saveBCFModelToJsonFile(bcf_model, "test.json")
22222222
#' bcf_model_roundtrip <- createBCFModelFromJsonFile("test.json")
22232223
createBCFModelFromJsonFile <- function(json_filename){

man/bcf.Rd

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/createBCFModelFromJson.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/createBCFModelFromJsonFile.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/getRandomEffectSamples.bcfmodel.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/saveBCFModelToJson.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/saveBCFModelToJsonFile.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/saveBCFModelToJsonString.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/R/testthat/test-bcf.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ test_that("MCMC BCF", {
6262
propensity_train = pi_train, X_test = X_test, Z_test = Z_test,
6363
propensity_test = pi_test, num_gfr = 0, num_burnin = 10,
6464
num_mcmc = 10, general_params = general_param_list,
65-
mu_forest_params = mu_forest_param_list,
66-
tau_forest_params = tau_forest_param_list)
65+
prognostic_forest_params = mu_forest_param_list,
66+
treatment_effect_forest_params = tau_forest_param_list)
6767
)
6868

6969
# 1 chain, no thinning, scalar leaf scale parameter provided
@@ -75,8 +75,8 @@ test_that("MCMC BCF", {
7575
propensity_train = pi_train, X_test = X_test, Z_test = Z_test,
7676
propensity_test = pi_test, num_gfr = 0, num_burnin = 10,
7777
num_mcmc = 10, general_params = general_param_list,
78-
mu_forest_params = mu_forest_param_list,
79-
tau_forest_params = tau_forest_param_list)
78+
prognostic_forest_params = mu_forest_param_list,
79+
treatment_effect_forest_params = tau_forest_param_list)
8080
)
8181

8282
# 3 chains, no thinning

0 commit comments

Comments
 (0)