Skip to content

Commit

Permalink
Fix class of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
fouodo committed Nov 28, 2024
1 parent 422b7be commit e371b74
Show file tree
Hide file tree
Showing 38 changed files with 245 additions and 246 deletions.
20 changes: 10 additions & 10 deletions R/Data.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Data <- R6Class("Data",
#' @description
#' Constructor of class Data.
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' Object ID.
#' @param ind_col (`character(1)`) \cr
#' @param ind_col `character` \cr
#' Column name containing individual IDs.
#' @param data_frame \cr
#' \code{data.frame} containing data.
Expand All @@ -42,9 +42,9 @@ Data <- R6Class("Data",
#' @description
#' Retrieve a data subset for a given variable name and values, a data subset.
#'
#' @param var_name (`character(1)`) \cr
#' @param var_name `character` \cr
#' Variable name of interest.
#' @param value (`vector(n)`) \cr
#' @param value `vector` \cr
#' Values of interest.
#'
#' @return
Expand All @@ -63,9 +63,9 @@ Data <- R6Class("Data",
#' Imputes missing values in modality-specific predictions.
#' Only mode and median based imputations are actually supported.
#'
#' @param impute_fct `character(1)` \cr
#' @param impute_fct `character` \cr
#' An imputation function to use instead of median or mode imputation. Not yet implemented!
#' @param impute_param `list(1)` \cr
#' @param impute_param `list` \cr
#' The list of parameters to call the imputation function.
#' @return
#' A new object with the predicted values is returned.
Expand Down Expand Up @@ -104,7 +104,7 @@ Data <- R6Class("Data",
#' @description
#' Retrieve a subset of variables from data.
#'
#' @param var_name (`character(n)`) \cr
#' @param var_name `character` \cr
#' Variable names of interest.
#'
#' @return
Expand All @@ -122,9 +122,9 @@ Data <- R6Class("Data",
#' For the given variable name, non existing values in the
#' current dataset are returned.
#'
#' @param var_name `character(1)` \cr
#' @param var_name `character` \cr
#' Variable name of interest.
#' @param value `vector(n)` \cr
#' @param value `vector` \cr
#' Values of interest.
#'
#' @return
Expand Down Expand Up @@ -155,7 +155,7 @@ Data <- R6Class("Data",
#' @description
#' Set a new \code{data.frame} to the current object.
#'
#' @param data_frame `data.frame(1)`
#' @param data_frame `data.frame`
#'
#' @return
#' The current object is returned.
Expand Down
12 changes: 6 additions & 6 deletions R/HashTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ HashTable <- R6Class("HashTable",
#' @description
#' Initialize a default parameters list.
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' ID of the hash table. It must be unique.
#'
#' @export
Expand All @@ -35,11 +35,11 @@ HashTable <- R6Class("HashTable",
},
#' @description
#' Function to add a key-value pair to the hash table.
#' @param key (`character(1)`) \cr
#' @param key `character` \cr
#' The key to be added.
#' @param value (`object(1)`) \cr
#' @param value `object` \cr
#' Object to be added.
#' @param .class (`character(1)`) \cr
#' @param .class `character` \cr
#' Class of the object to be added.
#' @export
#'
Expand All @@ -64,7 +64,7 @@ HashTable <- R6Class("HashTable",
#' @description
#' Getter of the object which the key passed as argument.
#'
#' @param key `character()` \cr
#' @param key `character` \cr
#' Key of the required object.
#'
#' @export
Expand Down Expand Up @@ -124,7 +124,7 @@ HashTable <- R6Class("HashTable",
#' @description
#' Check whether object from a class has already been stored.
#'
#' @param .class `character()` \cr
#' @param .class `character` \cr
#'
#' @return
#' Boolean value
Expand Down
28 changes: 14 additions & 14 deletions R/Lrner.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ Lrner <- R6Class("Lrner",
#'
#'
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' Learner ID.

#' @param package (`character(1)`) \cr
#' @param package `character` \cr
#' Package that implements the learn function. If NULL, the
#' @param lrn_fct (`character(1)`) \cr
#' @param lrn_fct `character` \cr
#' learn function is called from the current environment.
#' @param param_train_list \cr
#' @param param_train_list `list` \cr
#' List of parameter for training.
#' @param param_pred_list \cr
#' @param param_pred_list `list` \cr
#' List of parameter for testing.
#' Learn parameters.
#' @param train_layer (`TrainLayer(1)`) \cr
#' @param train_layer `TrainLayer` \cr
#' Layer on which the learner is stored.
#' @param na_action `character(1)`\cr
#' @param na_action `character` \cr
#' Handling of missing values. Set to "na.keep" to keep missing values, "na.rm" to remove individuals with missing values or "na.impute" (only applicable on meta-data) to impute missing values in meta-data. Only median and mode based imputations are actually handled. With the "na.keep" option, ensure that the provided learner can handle missing values.
initialize = function (id,
package = NULL,
Expand Down Expand Up @@ -115,15 +115,15 @@ Lrner <- R6Class("Lrner",
#' to provide how the following parameters are named in the learning
#' function (\code{lrn_fct}) you provided when creating the learner, or in the predicting function.
#'
#' @param x (`character(1)`) \cr
#' @param x `character` \cr
#' Name of the argument to pass the matrix of independent variables in the original learning function.
#' @param y (`character(1)`) \cr
#' @param y `character` \cr
#' Name of the argument to pass the response variable in the original learning function.
#' @param object (`character(1)`) \cr
#' @param object `character` \cr
#' Name of the argument to pass the model in the original predicting function.
#' @param data \cr
#' Name of the argument to pass new data in the original predicting function.
#' @param extract_pred_fct (`character(1) or function(1)`) \cr
#' @param extract_pred_fct `character` or `function` \cr
#' If the predict function that is called for the model does not return a vector, then
#' use this argument to specify a (or a name of a) function that can be used to extract vector of predictions.
#' Default value is NULL, if predictions are in a vector.
Expand Down Expand Up @@ -166,11 +166,11 @@ Lrner <- R6Class("Lrner",
#' @description
#' Tains the current learner (from class [Lrner]) on the current training data (from class [TrainData]).
#'
#' @param ind_subset `vector(1)` \cr
#' @param ind_subset `vector` \cr
#' Individual ID subset on which the training will be performed.
#' @param use_var_sel `boolean(1)` \cr
#' @param use_var_sel `boolean` \cr
#' If TRUE, variable selection is performed before training.
#' @param verbose (`boolean`) \cr
#' @param verbose `boolean` \cr
#' Warning messages will be displayed if set to TRUE.
#'
#' @return
Expand Down
14 changes: 7 additions & 7 deletions R/Model.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ Model <- R6Class("Model",
#' @description
#' Constructor of Model class.
#'
#' @param lrner (`Lrner(1)`) \cr
#' @param lrner `Lrner` \cr
#' The learner.
#' @param train_data (`TrainData(1)`) \cr
#' @param train_data `TrainData(1)` \cr
#' Training data.
#' @param base_model (`object(1)`) \cr
#' @param base_model `object` \cr
#' Base model as returned by the original learn function.
#' @param train_layer (`TrainLayer(1)`) \cr
#' @param train_layer `TrainLayer` \cr
#' The current training layer on which the model is stored.
#'
#' @return
Expand Down Expand Up @@ -124,11 +124,11 @@ Model <- R6Class("Model",
#' Predict target values for the new data
#' (from class [TestData]) taken as into.
#'
#' @param testing_data `TestData(1)` \cr
#' @param testing_data `TestData` \cr
#' An object from class [TestData].
#' @param use_var_sel `boolean(1)` \cr
#' @param use_var_sel `boolean` \cr
#' If TRUE, selected variables available at each layer are used.
#' @param ind_subset `vector(1)` \cr
#' @param ind_subset `vector` \cr
#' Subset of individual IDs to be predicted.
#' @param ...
#' Further parameters to be passed to the basic predict function.
Expand Down
6 changes: 3 additions & 3 deletions R/PredictData.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ PredictData <- R6Class("PredictData",
#' @description
#' Initialize a new object from the current class.
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' Object ID.
#' @param ind_col (`character(1)`)\cr
#' @param ind_col `character`\cr
#' Column name containing individual IDs.
#' @param data_frame (`data.frame(1)`)\cr
#' @param data_frame `data.frame`\cr
#' \code{data.frame} containing data.
initialize = function (id,
ind_col,
Expand Down
4 changes: 2 additions & 2 deletions R/PredictLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PredictLayer <- R6Class("PredictLayer",
#' @description
#' constructor
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' The layer ID.
initialize = function (id) {
super$initialize(id = id)
Expand Down Expand Up @@ -80,7 +80,7 @@ PredictLayer <- R6Class("PredictLayer",
#' @description
#' Assigns a predicting object to the predicted layer.
#'
#' @param predicting `Predicting(1)` \cr
#' @param predicting `Predicting` \cr
#'
#' @return
#' The current object
Expand Down
4 changes: 2 additions & 2 deletions R/PredictMetaLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ PredictMetaLayer <- R6Class("PredictMetaLayer",
#' @description
#' constructor
#'
#' @param id (`character(1)`)\cr
#' @param predicting (`Predicting(1)`)\cr
#' @param id `character`\cr
#' @param predicting `Predicting`\cr
#'
initialize = function (id, predicting) {
super$initialize(id = id)
Expand Down
4 changes: 2 additions & 2 deletions R/Predicting.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Predicting <- R6Class("Predicting",
#' @description
#' constructor
#'
#' @param id (`character(1)`)\cr
#' @param id `character`\cr
#' Predicting id.
#' @param ind_col (`character(1L)`)
#' @param ind_col `character`
#' Name of column of individuals IDS
initialize = function (id, ind_col) {
super$initialize(id = id)
Expand Down
6 changes: 3 additions & 3 deletions R/Target.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Target <- R6Class("Target",
#' @description
#' Initialize a new object from the current class.
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' The Object ID.
#' @param data_frame (`data.frame(1)`)\cr
#' @param data_frame `data.frame`\cr
#' \code{data.frame} containing data.
#' @param training (`Training(1)`) \cr
#' @param training `Training` \cr
#' Training where to store the current object.
initialize = function (id,
data_frame,
Expand Down
8 changes: 4 additions & 4 deletions R/TestData.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ TestData <- R6Class("TestData",
#' @description
#' Initialize a new object from the current class.
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' Object ID.
#' @param ind_col (`character(1)`)\cr
#' @param ind_col `character`\cr
#' Column name containing individual IDs.
#' @param data_frame (`data.frame(1)`)\cr
#' @param data_frame `data.frame`\cr
#' \code{data.frame} containing data.
#' @param new_layer (`TestLayer(1)`) \cr
#' @param new_layer `TestLayer` \cr
#' Layer where to store the current object.
# TODO: rename new_layer by test_layer
initialize = function (id,
Expand Down
5 changes: 2 additions & 3 deletions R/TestLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ TestLayer <- R6Class("TestLayer",
#' @description
#' constructor
#'
#' @param id (`character(1)`)\cr
#' @param id `character`\cr
#' Testing layer id.
#' @param testing (`Testing(1)`)\cr
#' @param testing `Testing`\cr
#'
initialize = function (id, testing) {
super$initialize(id = id)
Expand Down Expand Up @@ -113,6 +113,5 @@ TestLayer <- R6Class("TestLayer",
private = list(
testing = NULL
),
# TODO: define a deep_clone function for this class.
cloneable = FALSE
)
4 changes: 2 additions & 2 deletions R/TestMetaLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ TestMetaLayer <- R6Class("TestMetaLayer",
#' @description
#' constructor
#'
#' @param id (`character(1)`)\cr
#' @param id `character`\cr
#' Testing meta-layer id.
#' @param testing (`Testing(1)`)\cr
#' @param testing `Testing`\cr
#'
initialize = function (id, testing) {
super$initialize(id = id)
Expand Down
6 changes: 3 additions & 3 deletions R/Testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Testing <- R6Class("Testing",
#' @description
#' constructor
#'
#' @param id (`character(1)`)\cr
#' @param id `character`\cr
#' Testing id.
#' @param ind_col (`character(1)`)
#' @param ind_col `character`
#' Name of column of individuals IDS in testing data.frame.
#' @param verbose (`boolean`) \cr
#' @param verbose `boolean` \cr
#' Warning messages will be displayed if set to TRUE.
initialize = function (id, ind_col, verbose = TRUE) {
super$initialize(id = id)
Expand Down
6 changes: 3 additions & 3 deletions R/TrainData.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ TrainData <- R6Class("TrainData",
#' @description
#' Initialize a new object from the current class.
#'
#' @param id (`character(1)`) \cr
#' @param id `character` \cr
#' The Object ID.
#' @param data_frame (`data.frame(1)`)\cr
#' @param data_frame `data.frame`\cr
#' \code{data.frame} containing data.
#' @param train_layer (`TrainLayer(1)`) \cr
#' @param train_layer `TrainLayer` \cr
#' Training layer where to store the current object.
initialize = function (id,
data_frame,
Expand Down
Loading

0 comments on commit e371b74

Please sign in to comment.