Skip to content

Commit 83d553d

Browse files
committed
Updated indentation
1 parent 1a84fcc commit 83d553d

File tree

2 files changed

+46
-46
lines changed

2 files changed

+46
-46
lines changed

R/bart.R

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -250,16 +250,16 @@ bart <- function(
250250
drop_vars_variance <- variance_forest_params_updated$drop_vars
251251
num_features_subsample_variance <- variance_forest_params_updated$num_features_subsample
252252

253-
# Set a function-scoped RNG if user provided a random seed
254-
custom_rng <- random_seed >= 0
255-
if (custom_rng) {
256-
# Store original global environment RNG state
257-
original_global_seed <- .Random.seed
258-
# Set new seed and store associated RNG state
259-
set.seed(random_seed)
260-
function_scoped_seed <- .Random.seed
261-
}
262-
253+
# Set a function-scoped RNG if user provided a random seed
254+
custom_rng <- random_seed >= 0
255+
if (custom_rng) {
256+
# Store original global environment RNG state
257+
original_global_seed <- .Random.seed
258+
# Set new seed and store associated RNG state
259+
set.seed(random_seed)
260+
function_scoped_seed <- .Random.seed
261+
}
262+
263263
# Check if there are enough GFR samples to seed num_chains samplers
264264
if (num_gfr > 0) {
265265
if (num_chains > num_gfr) {
@@ -1748,27 +1748,27 @@ bart <- function(
17481748
}
17491749
class(result) <- "bartmodel"
17501750

1751-
# Clean up classes with external pointers to C++ data structures
1752-
if (include_mean_forest) {
1753-
rm(forest_model_mean)
1754-
}
1755-
if (include_variance_forest) {
1756-
rm(forest_model_variance)
1757-
}
1758-
rm(forest_dataset_train)
1759-
if (has_test) {
1760-
rm(forest_dataset_test)
1761-
}
1762-
if (has_rfx) {
1763-
rm(rfx_dataset_train, rfx_tracker_train, rfx_model)
1764-
}
1765-
rm(outcome_train)
1766-
rm(rng)
1767-
1768-
# Restore global RNG state if user provided a random seed
1769-
if (custom_rng) {
1770-
.Random.seed <- original_global_seed
1771-
}
1751+
# Clean up classes with external pointers to C++ data structures
1752+
if (include_mean_forest) {
1753+
rm(forest_model_mean)
1754+
}
1755+
if (include_variance_forest) {
1756+
rm(forest_model_variance)
1757+
}
1758+
rm(forest_dataset_train)
1759+
if (has_test) {
1760+
rm(forest_dataset_test)
1761+
}
1762+
if (has_rfx) {
1763+
rm(rfx_dataset_train, rfx_tracker_train, rfx_model)
1764+
}
1765+
rm(outcome_train)
1766+
rm(rng)
1767+
1768+
# Restore global RNG state if user provided a random seed
1769+
if (custom_rng) {
1770+
.Random.seed <- original_global_seed
1771+
}
17721772

17731773
return(result)
17741774
}

R/bcf.R

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,16 @@ bcf <- function(
340340
keep_vars_variance <- variance_forest_params_updated$keep_vars
341341
drop_vars_variance <- variance_forest_params_updated$drop_vars
342342
num_features_subsample_variance <- variance_forest_params_updated$num_features_subsample
343-
344-
# Set a function-scoped RNG if user provided a random seed
345-
custom_rng <- random_seed >= 0
346-
if (custom_rng) {
347-
# Store original global environment RNG state
348-
original_global_seed <- .Random.seed
349-
# Set new seed and store associated RNG state
350-
set.seed(random_seed)
351-
function_scoped_seed <- .Random.seed
352-
}
343+
344+
# Set a function-scoped RNG if user provided a random seed
345+
custom_rng <- random_seed >= 0
346+
if (custom_rng) {
347+
# Store original global environment RNG state
348+
original_global_seed <- .Random.seed
349+
# Set new seed and store associated RNG state
350+
set.seed(random_seed)
351+
function_scoped_seed <- .Random.seed
352+
}
353353

354354
# Check if there are enough GFR samples to seed num_chains samplers
355355
if (num_gfr > 0) {
@@ -2558,11 +2558,11 @@ bcf <- function(
25582558
result[["bart_propensity_model"]] = bart_model_propensity
25592559
}
25602560
class(result) <- "bcfmodel"
2561-
2562-
# Restore global RNG state if user provided a random seed
2563-
if (custom_rng) {
2564-
.Random.seed <- original_global_seed
2565-
}
2561+
2562+
# Restore global RNG state if user provided a random seed
2563+
if (custom_rng) {
2564+
.Random.seed <- original_global_seed
2565+
}
25662566

25672567
return(result)
25682568
}

0 commit comments

Comments
 (0)