Skip to content

Commit 36aa106

Browse files
committed
Updated interface and function names
1 parent 4fd36be commit 36aa106

14 files changed

+43
-43
lines changed

NAMESPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ export(createBCFModelFromJsonString)
2525
export(createCppJson)
2626
export(createCppJsonFile)
2727
export(createCppJsonString)
28+
export(createCppRNG)
2829
export(createForest)
29-
export(createForestContainer)
3030
export(createForestCovariates)
3131
export(createForestCovariatesFromMetadata)
3232
export(createForestDataset)
3333
export(createForestModel)
34+
export(createForestSamples)
3435
export(createOutcome)
3536
export(createPreprocessorFromJson)
3637
export(createPreprocessorFromJsonString)
37-
export(createRNG)
3838
export(createRandomEffectSamples)
3939
export(createRandomEffectsDataset)
4040
export(createRandomEffectsModel)

R/bart.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ bart <- function(X_train, y_train, leaf_basis_train = NULL, rfx_group_ids_train
536536

537537
# Random number generator (std::mt19937)
538538
if (is.null(random_seed)) random_seed = sample(1:10000,1,F)
539-
rng <- createRNG(random_seed)
539+
rng <- createCppRNG(random_seed)
540540

541541
# Sampling data structures
542542
feature_types <- as.integer(feature_types)
@@ -549,11 +549,11 @@ bart <- function(X_train, y_train, leaf_basis_train = NULL, rfx_group_ids_train
549549

550550
# Container of forest samples
551551
if (include_mean_forest) {
552-
forest_samples_mean <- createForestContainer(num_trees_mean, output_dimension, is_leaf_constant, FALSE)
552+
forest_samples_mean <- createForestSamples(num_trees_mean, output_dimension, is_leaf_constant, FALSE)
553553
active_forest_mean <- createForest(num_trees_mean, output_dimension, is_leaf_constant, FALSE)
554554
}
555555
if (include_variance_forest) {
556-
forest_samples_variance <- createForestContainer(num_trees_variance, 1, TRUE, TRUE)
556+
forest_samples_variance <- createForestSamples(num_trees_variance, 1, TRUE, TRUE)
557557
active_forest_variance <- createForest(num_trees_variance, 1, TRUE, TRUE)
558558
}
559559

R/bcf.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ bcf <- function(X_train, Z_train, y_train, propensity_train = NULL, rfx_group_id
760760

761761
# Random number generator (std::mt19937)
762762
if (is.null(random_seed)) random_seed = sample(1:10000,1,F)
763-
rng <- createRNG(random_seed)
763+
rng <- createCppRNG(random_seed)
764764

765765
# Sampling data structures
766766
forest_model_mu <- createForestModel(forest_dataset_train, feature_types, num_trees_mu, nrow(X_train), alpha_mu, beta_mu, min_samples_leaf_mu, max_depth_mu)
@@ -770,12 +770,12 @@ bcf <- function(X_train, Z_train, y_train, propensity_train = NULL, rfx_group_id
770770
}
771771

772772
# Container of forest samples
773-
forest_samples_mu <- createForestContainer(num_trees_mu, 1, T)
774-
forest_samples_tau <- createForestContainer(num_trees_tau, 1, F)
773+
forest_samples_mu <- createForestSamples(num_trees_mu, 1, T)
774+
forest_samples_tau <- createForestSamples(num_trees_tau, 1, F)
775775
active_forest_mu <- createForest(num_trees_mu, 1, T)
776776
active_forest_tau <- createForest(num_trees_tau, 1, F)
777777
if (include_variance_forest) {
778-
forest_samples_variance <- createForestContainer(num_trees_variance, 1, TRUE, TRUE)
778+
forest_samples_variance <- createForestSamples(num_trees_variance, 1, TRUE, TRUE)
779779
active_forest_variance <- createForest(num_trees_variance, 1, TRUE, TRUE)
780780
}
781781

R/calibration.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#' X <- matrix(runif(n*p), ncol = p)
1919
#' y <- 10*X[,1] - 20*X[,2] + rnorm(n)
2020
#' nu <- 3
21-
#' lambda <- calibrate_inverse_gamma_error_variance(y, X, nu = nu)
21+
#' lambda <- calibrateInverseGammaErrorVariance(y, X, nu = nu)
2222
#' sigma2hat <- mean(resid(lm(y~X))^2)
2323
#' mean(var(y)/rgamma(100000, nu, rate = nu*lambda) < sigma2hat)
2424
calibrateInverseGammaErrorVariance <- function(y, X, W = NULL, nu = 3, quant = 0.9, standardize = TRUE) {

R/forest.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ Forest <- R6::R6Class(
758758
#'
759759
#' @return `ForestSamples` object
760760
#' @export
761-
createForestContainer <- function(num_trees, output_dimension=1, is_leaf_constant=F, is_exponentiated=F) {
761+
createForestSamples <- function(num_trees, output_dimension=1, is_leaf_constant=F, is_exponentiated=F) {
762762
return(invisible((
763763
ForestSamples$new(num_trees, output_dimension, is_leaf_constant, is_exponentiated)
764764
)))

R/model.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ ForestModel <- R6::R6Class(
170170
#'
171171
#' @return `CppRng` object
172172
#' @export
173-
createRNG <- function(random_seed = -1){
173+
createCppRNG <- function(random_seed = -1){
174174
return(invisible((
175175
CppRNG$new(random_seed)
176176
)))

_pkgdown.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ reference:
8888
- ForestModel
8989
- createForestModel
9090
- ForestSamples
91-
- createForestContainer
91+
- createForestSamples
9292
- CppRNG
93-
- createRNG
93+
- createCppRNG
9494
- calibrateInverseGammaErrorVariance
9595
- preprocessParams
9696
- computeMaxLeafIndex

man/calibrateInverseGammaErrorVariance.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/createRNG.Rd renamed to man/createCppRNG.Rd

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

man/createForestContainer.Rd renamed to man/createForestSamples.Rd

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

0 commit comments

Comments
 (0)