diff --git a/R/bart.R b/R/bart.R index e70cbdda..1c814dd3 100644 --- a/R/bart.R +++ b/R/bart.R @@ -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 diff --git a/R/data.R b/R/data.R index d90265ae..4f35efc0 100644 --- a/R/data.R +++ b/R/data.R @@ -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") @@ -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") @@ -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") diff --git a/R/forest.R b/R/forest.R index 4a0680cb..224e8c7c 100644 --- a/R/forest.R +++ b/R/forest.R @@ -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) }, @@ -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) }, @@ -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 @@ -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 diff --git a/R/model.R b/R/model.R index 534cf7bc..5dc1de69 100644 --- a/R/model.R +++ b/R/model.R @@ -125,7 +125,7 @@ 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) }, @@ -133,7 +133,7 @@ ForestModel <- R6::R6Class( #' @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) }, @@ -141,7 +141,7 @@ ForestModel <- R6::R6Class( #' @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) }, @@ -149,7 +149,7 @@ ForestModel <- R6::R6Class( #' @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) }, @@ -157,7 +157,7 @@ ForestModel <- R6::R6Class( #' @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) } diff --git a/R/random_effects.R b/R/random_effects.R index 38c47166..f9d0b70c 100644 --- a/R/random_effects.R +++ b/R/random_effects.R @@ -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) @@ -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) }, @@ -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) @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/R/serialization.R b/R/serialization.R index 14463c52..d5d4e046 100644 --- a/R/serialization.R +++ b/R/serialization.R @@ -45,7 +45,7 @@ CppJson <- R6::R6Class( #' @description #' Convert a forest container to json and add to the current `CppJson` object #' @param forest_samples `ForestSamples` R class - #' @return NULL + #' @return None add_forest = function(forest_samples) { forest_label <- json_add_forest_cpp(self$json_ptr, forest_samples$forest_container_ptr) self$num_forests <- self$num_forests + 1 @@ -55,7 +55,7 @@ CppJson <- R6::R6Class( #' @description #' Convert a random effects container to json and add to the current `CppJson` object #' @param rfx_samples `RandomEffectSamples` R class - #' @return NULL + #' @return None add_random_effects = function(rfx_samples) { rfx_container_label <- json_add_rfx_container_cpp(self$json_ptr, rfx_samples$rfx_container_ptr) self$rfx_container_labels <- c(self$rfx_container_labels, rfx_container_label) @@ -72,7 +72,7 @@ CppJson <- R6::R6Class( #' @param field_name The name of the field to be added to json #' @param field_value Numeric value of the field to be added to json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which to place the value - #' @return NULL + #' @return None add_scalar = function(field_name, field_value, subfolder_name = NULL) { if (is.null(subfolder_name)) { json_add_double_cpp(self$json_ptr, field_name, field_value) @@ -86,7 +86,7 @@ CppJson <- R6::R6Class( #' @param field_name The name of the field to be added to json #' @param field_value Integer value of the field to be added to json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which to place the value - #' @return NULL + #' @return None add_integer = function(field_name, field_value, subfolder_name = NULL) { if (is.null(subfolder_name)) { json_add_integer_cpp(self$json_ptr, field_name, field_value) @@ -100,7 +100,7 @@ CppJson <- R6::R6Class( #' @param field_name The name of the field to be added to json #' @param field_value Numeric value of the field to be added to json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which to place the value - #' @return NULL + #' @return None add_boolean = function(field_name, field_value, subfolder_name = NULL) { if (is.null(subfolder_name)) { json_add_bool_cpp(self$json_ptr, field_name, field_value) @@ -114,7 +114,7 @@ CppJson <- R6::R6Class( #' @param field_name The name of the field to be added to json #' @param field_value Numeric value of the field to be added to json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which to place the value - #' @return NULL + #' @return None add_string = function(field_name, field_value, subfolder_name = NULL) { if (is.null(subfolder_name)) { json_add_string_cpp(self$json_ptr, field_name, field_value) @@ -128,7 +128,7 @@ CppJson <- R6::R6Class( #' @param field_name The name of the field to be added to json #' @param field_vector Vector to be stored in json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which to place the value - #' @return NULL + #' @return None add_vector = function(field_name, field_vector, subfolder_name = NULL) { field_vector <- as.numeric(field_vector) if (is.null(subfolder_name)) { @@ -143,7 +143,7 @@ CppJson <- R6::R6Class( #' @param field_name The name of the field to be added to json #' @param field_vector Vector to be stored in json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which to place the value - #' @return NULL + #' @return None add_integer_vector = function(field_name, field_vector, subfolder_name = NULL) { field_vector <- as.numeric(field_vector) if (is.null(subfolder_name)) { @@ -158,7 +158,7 @@ CppJson <- R6::R6Class( #' @param field_name The name of the field to be added to json #' @param field_vector Character vector to be stored in json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which to place the value - #' @return NULL + #' @return None add_string_vector = function(field_name, field_vector, subfolder_name = NULL) { if (is.null(subfolder_name)) { json_add_string_vector_cpp(self$json_ptr, field_name, field_vector) @@ -171,7 +171,7 @@ CppJson <- R6::R6Class( #' Add a list of vectors (as an object map of arrays) to the json object under the name "field_name" #' @param field_name The name of the field to be added to json #' @param field_list List to be stored in json - #' @return NULL + #' @return None add_list = function(field_name, field_list) { stopifnot(sum(!sapply(field_list, is.vector))==0) list_names <- names(field_list) @@ -186,7 +186,7 @@ CppJson <- R6::R6Class( #' Add a list of vectors (as an object map of arrays) to the json object under the name "field_name" #' @param field_name The name of the field to be added to json #' @param field_list List to be stored in json - #' @return NULL + #' @return None add_string_list = function(field_name, field_list) { stopifnot(sum(!sapply(field_list, is.vector))==0) list_names <- names(field_list) @@ -201,7 +201,7 @@ CppJson <- R6::R6Class( #' Retrieve a scalar value from the json object under the name "field_name" (with optional subfolder "subfolder_name") #' @param field_name The name of the field to be accessed from json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which the field is stored - #' @return NULL + #' @return None get_scalar = function(field_name, subfolder_name = NULL) { if (is.null(subfolder_name)) { stopifnot(json_contains_field_cpp(self$json_ptr, field_name)) @@ -217,7 +217,7 @@ CppJson <- R6::R6Class( #' Retrieve a integer value from the json object under the name "field_name" (with optional subfolder "subfolder_name") #' @param field_name The name of the field to be accessed from json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which the field is stored - #' @return NULL + #' @return None get_integer = function(field_name, subfolder_name = NULL) { if (is.null(subfolder_name)) { stopifnot(json_contains_field_cpp(self$json_ptr, field_name)) @@ -233,7 +233,7 @@ CppJson <- R6::R6Class( #' Retrieve a boolean value from the json object under the name "field_name" (with optional subfolder "subfolder_name") #' @param field_name The name of the field to be accessed from json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which the field is stored - #' @return NULL + #' @return None get_boolean = function(field_name, subfolder_name = NULL) { if (is.null(subfolder_name)) { stopifnot(json_contains_field_cpp(self$json_ptr, field_name)) @@ -249,7 +249,7 @@ CppJson <- R6::R6Class( #' Retrieve a string value from the json object under the name "field_name" (with optional subfolder "subfolder_name") #' @param field_name The name of the field to be accessed from json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which the field is stored - #' @return NULL + #' @return None get_string = function(field_name, subfolder_name = NULL) { if (is.null(subfolder_name)) { stopifnot(json_contains_field_cpp(self$json_ptr, field_name)) @@ -265,7 +265,7 @@ CppJson <- R6::R6Class( #' Retrieve a vector from the json object under the name "field_name" (with optional subfolder "subfolder_name") #' @param field_name The name of the field to be accessed from json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which the field is stored - #' @return NULL + #' @return None get_vector = function(field_name, subfolder_name = NULL) { if (is.null(subfolder_name)) { stopifnot(json_contains_field_cpp(self$json_ptr, field_name)) @@ -281,7 +281,7 @@ CppJson <- R6::R6Class( #' Retrieve an integer vector from the json object under the name "field_name" (with optional subfolder "subfolder_name") #' @param field_name The name of the field to be accessed from json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which the field is stored - #' @return NULL + #' @return None get_integer_vector = function(field_name, subfolder_name = NULL) { if (is.null(subfolder_name)) { stopifnot(json_contains_field_cpp(self$json_ptr, field_name)) @@ -297,7 +297,7 @@ CppJson <- R6::R6Class( #' Retrieve a character vector from the json object under the name "field_name" (with optional subfolder "subfolder_name") #' @param field_name The name of the field to be accessed from json #' @param subfolder_name (Optional) Name of the subfolder / hierarchy under which the field is stored - #' @return NULL + #' @return None get_string_vector = function(field_name, subfolder_name = NULL) { if (is.null(subfolder_name)) { stopifnot(json_contains_field_cpp(self$json_ptr, field_name)) @@ -313,7 +313,7 @@ CppJson <- R6::R6Class( #' Reconstruct a list of numeric vectors from the json object stored under "field_name" #' @param field_name The name of the field to be added to json #' @param key_names Vector of names of list elements (each of which is a vector) - #' @return NULL + #' @return None get_numeric_list = function(field_name, key_names) { output <- list() for (i in 1:length(key_names)) { @@ -327,7 +327,7 @@ CppJson <- R6::R6Class( #' Reconstruct a list of string vectors from the json object stored under "field_name" #' @param field_name The name of the field to be added to json #' @param key_names Vector of names of list elements (each of which is a vector) - #' @return NULL + #' @return None get_string_list = function(field_name, key_names) { output <- list() for (i in 1:length(key_names)) { @@ -347,7 +347,7 @@ CppJson <- R6::R6Class( #' @description #' Save a json object to file #' @param filename String of filepath, must end in ".json" - #' @return NULL + #' @return None save_file = function(filename) { json_save_file_cpp(self$json_ptr, filename) }, @@ -355,7 +355,7 @@ CppJson <- R6::R6Class( #' @description #' Load a json object from file #' @param filename String of filepath, must end in ".json" - #' @return NULL + #' @return None load_from_file = function(filename) { json_load_file_cpp(self$json_ptr, filename) }, @@ -363,7 +363,7 @@ CppJson <- R6::R6Class( #' @description #' Load a json object from string #' @param json_string JSON string dump - #' @return NULL + #' @return None load_from_string = function(json_string) { json_load_string_cpp(self$json_ptr, json_string) } diff --git a/R/variance.R b/R/variance.R index f2688b15..32fc9a21 100644 --- a/R/variance.R +++ b/R/variance.R @@ -5,6 +5,7 @@ #' @param rng C++ random number generator #' @param a Global variance shape parameter #' @param b Global variance scale parameter +#' @return None #' @export #' #' @examples @@ -27,7 +28,7 @@ sampleGlobalErrorVarianceOneIteration <- function(residual, dataset, rng, a, b) #' @param rng C++ random number generator #' @param a Leaf variance shape parameter #' @param b Leaf variance scale parameter -#' +#' @return None #' @export #' #' @examples diff --git a/man/CppJson.Rd b/man/CppJson.Rd index 65f1edec..828230f5 100644 --- a/man/CppJson.Rd +++ b/man/CppJson.Rd @@ -85,7 +85,7 @@ Convert a forest container to json and add to the current \code{CppJson} object \if{html}{\out{}} } \subsection{Returns}{ -NULL +None } } \if{html}{\out{