Skip to content

Commit 0a9352f

Browse files
authored
Merge pull request #134 from StochasticTree/model-config-refactor
Updating docs and vignettes to reflect interface changes and prepare for CRAN submission
2 parents 7a8a87c + 32b0a85 commit 0a9352f

22 files changed

+112
-78
lines changed

R/bart.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ saveBARTModelToJson <- function(object){
12301230
#' @param object Object of type `bartmodel` containing draws of a BART model and associated sampling outputs.
12311231
#' @param filename String of filepath, must end in ".json"
12321232
#'
1233-
#' @return NULL
1233+
#' @return None
12341234
#' @export
12351235
#'
12361236
#' @examples

R/data.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ Outcome <- R6::R6Class(
111111
#' @description
112112
#' Update the current state of the outcome (i.e. partial residual) data by adding the values of `update_vector`
113113
#' @param update_vector Vector to be added to outcome
114-
#' @return NULL
114+
#' @return None
115115
add_vector = function(update_vector) {
116116
if (!is.numeric(update_vector)) {
117117
stop("update_vector must be a numeric vector or 2d matrix")
@@ -128,7 +128,7 @@ Outcome <- R6::R6Class(
128128
#' @description
129129
#' Update the current state of the outcome (i.e. partial residual) data by subtracting the values of `update_vector`
130130
#' @param update_vector Vector to be subtracted from outcome
131-
#' @return NULL
131+
#' @return None
132132
subtract_vector = function(update_vector) {
133133
if (!is.numeric(update_vector)) {
134134
stop("update_vector must be a numeric vector or 2d matrix")
@@ -145,7 +145,7 @@ Outcome <- R6::R6Class(
145145
#' @description
146146
#' Update the current state of the outcome (i.e. partial residual) data by replacing each element with the elements of `new_vector`
147147
#' @param new_vector Vector from which to overwrite the current data
148-
#' @return NULL
148+
#' @return None
149149
update_data = function(new_vector) {
150150
if (!is.numeric(new_vector)) {
151151
stop("update_vector must be a numeric vector or 2d matrix")

R/forest.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ForestSamples <- R6::R6Class(
3535
#' Append to a `ForestContainer` object from a json object
3636
#' @param json_object Object of class `CppJson`
3737
#' @param json_forest_label Label referring to a particular forest (i.e. "forest_0") in the overall json hierarchy
38-
#' @return NULL
38+
#' @return None
3939
append_from_json = function(json_object, json_forest_label) {
4040
forest_container_append_from_json_cpp(self$forest_container_ptr, json_object$json_ptr, json_forest_label)
4141
},
@@ -53,7 +53,7 @@ ForestSamples <- R6::R6Class(
5353
#' Append to a `ForestContainer` object from a json object
5454
#' @param json_string JSON string which parses into object of class `CppJson`
5555
#' @param json_forest_label Label referring to a particular forest (i.e. "forest_0") in the overall json hierarchy
56-
#' @return NULL
56+
#' @return None
5757
append_from_json_string = function(json_string, json_forest_label) {
5858
forest_container_append_from_json_string_cpp(self$forest_container_ptr, json_string, json_forest_label)
5959
},
@@ -799,6 +799,7 @@ createForest <- function(num_trees, leaf_dimension=1, is_leaf_constant=F, is_exp
799799
#' @param active_forest Current active forest
800800
#' @param forest_samples (Optional) Container of forest samples from which to re-initialize active forest. If not provided, active forest will be reset to an ensemble of single-node (i.e. root) trees.
801801
#' @param forest_num (Optional) Index of forest samples from which to initialize active forest. If not provided, active forest will be reset to an ensemble of single-node (i.e. root) trees.
802+
#' @return None
802803
#' @export
803804
#'
804805
#' @examples
@@ -832,6 +833,7 @@ resetActiveForest <- function(active_forest, forest_samples=NULL, forest_num=NUL
832833
#' @param dataset Training dataset object
833834
#' @param residual Residual which will also be updated
834835
#' @param is_mean_model Whether the model being updated is a conditional mean model
836+
#' @return None
835837
#' @export
836838
#'
837839
#' @examples

R/model.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,39 +125,39 @@ ForestModel <- R6::R6Class(
125125
#' Update the current state of the outcome (i.e. partial residual) data by subtracting the current predictions of each tree.
126126
#' This function is run after the `Outcome` class's `update_data` method, which overwrites the partial residual with an entirely new stream of outcome data.
127127
#' @param residual Outcome used to sample the forest
128-
#' @return NULL
128+
#' @return None
129129
propagate_residual_update = function(residual) {
130130
propagate_trees_column_vector_cpp(self$tracker_ptr, residual$data_ptr)
131131
},
132132

133133
#' @description
134134
#' Update alpha in the tree prior
135135
#' @param alpha New value of alpha to be used
136-
#' @return NULL
136+
#' @return None
137137
update_alpha = function(alpha) {
138138
update_alpha_tree_prior_cpp(self$tree_prior_ptr, alpha)
139139
},
140140

141141
#' @description
142142
#' Update beta in the tree prior
143143
#' @param beta New value of beta to be used
144-
#' @return NULL
144+
#' @return None
145145
update_beta = function(beta) {
146146
update_beta_tree_prior_cpp(self$tree_prior_ptr, beta)
147147
},
148148

149149
#' @description
150150
#' Update min_samples_leaf in the tree prior
151151
#' @param min_samples_leaf New value of min_samples_leaf to be used
152-
#' @return NULL
152+
#' @return None
153153
update_min_samples_leaf = function(min_samples_leaf) {
154154
update_min_samples_leaf_tree_prior_cpp(self$tree_prior_ptr, min_samples_leaf)
155155
},
156156

157157
#' @description
158158
#' Update max_depth in the tree prior
159159
#' @param max_depth New value of max_depth to be used
160-
#' @return NULL
160+
#' @return None
161161
update_max_depth = function(max_depth) {
162162
update_max_depth_tree_prior_cpp(self$tree_prior_ptr, max_depth)
163163
}

R/random_effects.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ RandomEffectSamples <- R6::R6Class(
3232
#' @param num_components Number of "components" or bases defining the random effects regression
3333
#' @param num_groups Number of random effects groups
3434
#' @param random_effects_tracker Object of type `RandomEffectsTracker`
35-
#' @return NULL
35+
#' @return None
3636
load_in_session = function(num_components, num_groups, random_effects_tracker) {
3737
# Initialize
3838
self$rfx_container_ptr <- rfx_container_cpp(num_components, num_groups)
@@ -59,7 +59,7 @@ RandomEffectSamples <- R6::R6Class(
5959
#' @param json_rfx_container_label Label referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
6060
#' @param json_rfx_mapper_label Label referring to a particular rfx label mapper (i.e. "random_effect_label_mapper_0") in the overall json hierarchy
6161
#' @param json_rfx_groupids_label Label referring to a particular set of rfx group IDs (i.e. "random_effect_groupids_0") in the overall json hierarchy
62-
#' @return NULL (updates object in-place)
62+
#' @return None
6363
append_from_json = function(json_object, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label) {
6464
rfx_container_append_from_json_cpp(self$rfx_container_ptr, json_object$json_ptr, json_rfx_container_label)
6565
},
@@ -83,7 +83,7 @@ RandomEffectSamples <- R6::R6Class(
8383
#' @param json_rfx_container_label Label referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
8484
#' @param json_rfx_mapper_label Label referring to a particular rfx label mapper (i.e. "random_effect_label_mapper_0") in the overall json hierarchy
8585
#' @param json_rfx_groupids_label Label referring to a particular set of rfx group IDs (i.e. "random_effect_groupids_0") in the overall json hierarchy
86-
#' @return NULL (updates object in-place)
86+
#' @return None
8787
append_from_json_string = function(json_string, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label) {
8888
# Append RFX objects
8989
rfx_container_append_from_json_string_cpp(self$rfx_container_ptr, json_string, json_rfx_container_label)
@@ -398,6 +398,7 @@ createRandomEffectsModel <- function(num_components, num_groups) {
398398
#' @param rfx_samples Object of type `RandomEffectSamples`.
399399
#' @param sample_num Index of sample stored in `rfx_samples` from which to reset the state of a random effects model. Zero-indexed, so resetting based on the first sample would require setting `sample_num = 0`.
400400
#' @param sigma_alpha_init Initial value of the "working parameter" scale parameter.
401+
#' @return None
401402
#' @export
402403
#'
403404
#' @examples
@@ -439,6 +440,7 @@ resetRandomEffectsModel <- function(rfx_model, rfx_samples, sample_num, sigma_al
439440
#' @param rfx_dataset Object of type `RandomEffectsDataset`.
440441
#' @param residual Object of type `Outcome`.
441442
#' @param rfx_samples Object of type `RandomEffectSamples`.
443+
#' @return None
442444
#' @export
443445
#'
444446
#' @examples
@@ -476,6 +478,7 @@ resetRandomEffectsTracker <- function(rfx_tracker, rfx_model, rfx_dataset, resid
476478
#' @param sigma_xi_init Initial value of the "group parameters" scale parameter.
477479
#' @param sigma_xi_shape Shape parameter for the inverse gamma variance model on the group parameters.
478480
#' @param sigma_xi_scale Scale parameter for the inverse gamma variance model on the group parameters.
481+
#' @return None
479482
#' @export
480483
#'
481484
#' @examples
@@ -522,6 +525,7 @@ rootResetRandomEffectsModel <- function(rfx_model, alpha_init, xi_init, sigma_al
522525
#' @param rfx_model Object of type `RandomEffectsModel`.
523526
#' @param rfx_dataset Object of type `RandomEffectsDataset`.
524527
#' @param residual Object of type `Outcome`.
528+
#' @return None
525529
#' @export
526530
#'
527531
#' @examples

0 commit comments

Comments
 (0)