Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/bart.R
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ saveBARTModelToJson <- function(object){
#' @param object Object of type `bartmodel` containing draws of a BART model and associated sampling outputs.
#' @param filename String of filepath, must end in ".json"
#'
#' @return NULL
#' @return None
#' @export
#'
#' @examples
Expand Down
6 changes: 3 additions & 3 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Outcome <- R6::R6Class(
#' @description
#' Update the current state of the outcome (i.e. partial residual) data by adding the values of `update_vector`
#' @param update_vector Vector to be added to outcome
#' @return NULL
#' @return None
add_vector = function(update_vector) {
if (!is.numeric(update_vector)) {
stop("update_vector must be a numeric vector or 2d matrix")
Expand All @@ -128,7 +128,7 @@ Outcome <- R6::R6Class(
#' @description
#' Update the current state of the outcome (i.e. partial residual) data by subtracting the values of `update_vector`
#' @param update_vector Vector to be subtracted from outcome
#' @return NULL
#' @return None
subtract_vector = function(update_vector) {
if (!is.numeric(update_vector)) {
stop("update_vector must be a numeric vector or 2d matrix")
Expand All @@ -145,7 +145,7 @@ Outcome <- R6::R6Class(
#' @description
#' Update the current state of the outcome (i.e. partial residual) data by replacing each element with the elements of `new_vector`
#' @param new_vector Vector from which to overwrite the current data
#' @return NULL
#' @return None
update_data = function(new_vector) {
if (!is.numeric(new_vector)) {
stop("update_vector must be a numeric vector or 2d matrix")
Expand Down
6 changes: 4 additions & 2 deletions R/forest.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ForestSamples <- R6::R6Class(
#' Append to a `ForestContainer` object from a json object
#' @param json_object Object of class `CppJson`
#' @param json_forest_label Label referring to a particular forest (i.e. "forest_0") in the overall json hierarchy
#' @return NULL
#' @return None
append_from_json = function(json_object, json_forest_label) {
forest_container_append_from_json_cpp(self$forest_container_ptr, json_object$json_ptr, json_forest_label)
},
Expand All @@ -53,7 +53,7 @@ ForestSamples <- R6::R6Class(
#' Append to a `ForestContainer` object from a json object
#' @param json_string JSON string which parses into object of class `CppJson`
#' @param json_forest_label Label referring to a particular forest (i.e. "forest_0") in the overall json hierarchy
#' @return NULL
#' @return None
append_from_json_string = function(json_string, json_forest_label) {
forest_container_append_from_json_string_cpp(self$forest_container_ptr, json_string, json_forest_label)
},
Expand Down Expand Up @@ -799,6 +799,7 @@ createForest <- function(num_trees, leaf_dimension=1, is_leaf_constant=F, is_exp
#' @param active_forest Current active forest
#' @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.
#' @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.
#' @return None
#' @export
#'
#' @examples
Expand Down Expand Up @@ -832,6 +833,7 @@ resetActiveForest <- function(active_forest, forest_samples=NULL, forest_num=NUL
#' @param dataset Training dataset object
#' @param residual Residual which will also be updated
#' @param is_mean_model Whether the model being updated is a conditional mean model
#' @return None
#' @export
#'
#' @examples
Expand Down
10 changes: 5 additions & 5 deletions R/model.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,39 +125,39 @@ ForestModel <- R6::R6Class(
#' Update the current state of the outcome (i.e. partial residual) data by subtracting the current predictions of each tree.
#' 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.
#' @param residual Outcome used to sample the forest
#' @return NULL
#' @return None
propagate_residual_update = function(residual) {
propagate_trees_column_vector_cpp(self$tracker_ptr, residual$data_ptr)
},

#' @description
#' Update alpha in the tree prior
#' @param alpha New value of alpha to be used
#' @return NULL
#' @return None
update_alpha = function(alpha) {
update_alpha_tree_prior_cpp(self$tree_prior_ptr, alpha)
},

#' @description
#' Update beta in the tree prior
#' @param beta New value of beta to be used
#' @return NULL
#' @return None
update_beta = function(beta) {
update_beta_tree_prior_cpp(self$tree_prior_ptr, beta)
},

#' @description
#' Update min_samples_leaf in the tree prior
#' @param min_samples_leaf New value of min_samples_leaf to be used
#' @return NULL
#' @return None
update_min_samples_leaf = function(min_samples_leaf) {
update_min_samples_leaf_tree_prior_cpp(self$tree_prior_ptr, min_samples_leaf)
},

#' @description
#' Update max_depth in the tree prior
#' @param max_depth New value of max_depth to be used
#' @return NULL
#' @return None
update_max_depth = function(max_depth) {
update_max_depth_tree_prior_cpp(self$tree_prior_ptr, max_depth)
}
Expand Down
10 changes: 7 additions & 3 deletions R/random_effects.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RandomEffectSamples <- R6::R6Class(
#' @param num_components Number of "components" or bases defining the random effects regression
#' @param num_groups Number of random effects groups
#' @param random_effects_tracker Object of type `RandomEffectsTracker`
#' @return NULL
#' @return None
load_in_session = function(num_components, num_groups, random_effects_tracker) {
# Initialize
self$rfx_container_ptr <- rfx_container_cpp(num_components, num_groups)
Expand All @@ -59,7 +59,7 @@ RandomEffectSamples <- R6::R6Class(
#' @param json_rfx_container_label Label referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
#' @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
#' @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
#' @return NULL (updates object in-place)
#' @return None
append_from_json = function(json_object, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label) {
rfx_container_append_from_json_cpp(self$rfx_container_ptr, json_object$json_ptr, json_rfx_container_label)
},
Expand All @@ -83,7 +83,7 @@ RandomEffectSamples <- R6::R6Class(
#' @param json_rfx_container_label Label referring to a particular rfx sample container (i.e. "random_effect_container_0") in the overall json hierarchy
#' @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
#' @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
#' @return NULL (updates object in-place)
#' @return None
append_from_json_string = function(json_string, json_rfx_container_label, json_rfx_mapper_label, json_rfx_groupids_label) {
# Append RFX objects
rfx_container_append_from_json_string_cpp(self$rfx_container_ptr, json_string, json_rfx_container_label)
Expand Down Expand Up @@ -398,6 +398,7 @@ createRandomEffectsModel <- function(num_components, num_groups) {
#' @param rfx_samples Object of type `RandomEffectSamples`.
#' @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`.
#' @param sigma_alpha_init Initial value of the "working parameter" scale parameter.
#' @return None
#' @export
#'
#' @examples
Expand Down Expand Up @@ -439,6 +440,7 @@ resetRandomEffectsModel <- function(rfx_model, rfx_samples, sample_num, sigma_al
#' @param rfx_dataset Object of type `RandomEffectsDataset`.
#' @param residual Object of type `Outcome`.
#' @param rfx_samples Object of type `RandomEffectSamples`.
#' @return None
#' @export
#'
#' @examples
Expand Down Expand Up @@ -476,6 +478,7 @@ resetRandomEffectsTracker <- function(rfx_tracker, rfx_model, rfx_dataset, resid
#' @param sigma_xi_init Initial value of the "group parameters" scale parameter.
#' @param sigma_xi_shape Shape parameter for the inverse gamma variance model on the group parameters.
#' @param sigma_xi_scale Scale parameter for the inverse gamma variance model on the group parameters.
#' @return None
#' @export
#'
#' @examples
Expand Down Expand Up @@ -522,6 +525,7 @@ rootResetRandomEffectsModel <- function(rfx_model, alpha_init, xi_init, sigma_al
#' @param rfx_model Object of type `RandomEffectsModel`.
#' @param rfx_dataset Object of type `RandomEffectsDataset`.
#' @param residual Object of type `Outcome`.
#' @return None
#' @export
#'
#' @examples
Expand Down
Loading
Loading