Skip to content

Commit

Permalink
Fix CRAN check issues
Browse files Browse the repository at this point in the history
  • Loading branch information
fouodo committed Dec 14, 2024
1 parent 3e2b602 commit 1edeb70
Show file tree
Hide file tree
Showing 55 changed files with 119 additions and 95 deletions.
14 changes: 7 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Package: fuseMLR
Type: Package
Title: Fusing machine learning in R
Version: 0.0.1
Authors@R: c(person(given = c("Cesaire", "J.", "K."),
family = "Fouodo",
role = "aut"),
person(given = c("The", "package"),
family = "maintainer",
role = "cre",
email = "[email protected]"))
Authors@R: c(person(given = c("Cesaire", "J."),
family = c("K.", "Fouodo"),
role = c("aut", "cre"),
email = "[email protected]")
)
Author: Cesaire J. K. Fouodo
Maintainer: Cesaire J. K. Fouodo <[email protected]>
Description: Recent technological advances have enable the simultaneous collection
of multi-omics data i.e., different types or modalities of molecular data,
presenting challenges for integrative prediction modeling due to the heterogeneous,
Expand Down
6 changes: 3 additions & 3 deletions R/Data.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Data <- R6Class("Data",
#' Object ID.
#' @param ind_col `character` \cr
#' Column name containing individual IDs.
#' @param data_frame \cr
#' \code{data.frame} containing data.
#' @param data_frame `data.frame` \cr
#' `data.frame` containing data.
initialize = function (id, ind_col, data_frame) {
private$id = id
private$ind_col = ind_col
Expand All @@ -30,7 +30,7 @@ Data <- R6Class("Data",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function(...) { # nocov start
cat("Class : Data\n")
Expand Down
2 changes: 1 addition & 1 deletion R/HashTable.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ HashTable <- R6Class("HashTable",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
#' @export
#'
Expand Down
6 changes: 3 additions & 3 deletions R/Lrner.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Lrner <- R6Class("Lrner",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
cat(sprintf("Learner : %s\n", private$id))
Expand All @@ -103,7 +103,7 @@ Lrner <- R6Class("Lrner",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
summary = function (...) {
cat(sprintf(" Learner : %s\n", private$id))
Expand All @@ -122,7 +122,7 @@ Lrner <- R6Class("Lrner",
#' Name of the argument to pass the response variable in the original learning function.
#' @param object `character` \cr
#' Name of the argument to pass the model in the original predicting function.
#' @param data \cr
#' @param data `character` \cr
#' Name of the argument to pass new data in the original predicting function.
#' @param extract_pred_fct `character` or `function` \cr
#' If the predict function that is called for the model does not return a vector, then
Expand Down
8 changes: 4 additions & 4 deletions R/Model.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Model <- R6Class("Model",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
cat("Class : Model\n\n")
Expand All @@ -66,7 +66,7 @@ Model <- R6Class("Model",
},
#' @description
#' Summary
#' @param ... (any) \cr
#' @param ... `any`
#'
summary = function (...) {
cat(" Model \n\n")
Expand Down Expand Up @@ -94,7 +94,7 @@ Model <- R6Class("Model",
#' @description
#' Getter of the individual ID column in the training data.
#'
#' @param ... (any) \cr
#' @param ... `any`
#'
getTrainLabel = function () {
train_data = private$train_data
Expand All @@ -111,7 +111,7 @@ Model <- R6Class("Model",
#' @description
#' Setter of the model ID.
#'
#' @param id \cr
#' @param id `character` \cr
#' ID value
#'
#' @export
Expand Down
2 changes: 1 addition & 1 deletion R/PredictData.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ PredictData <- R6Class("PredictData",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
cat("Class : PredictData\n")
Expand Down
2 changes: 1 addition & 1 deletion R/PredictLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ PredictLayer <- R6Class("PredictLayer",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...){
cat(sprintf("PredictLayer : %s\n", private$id))
Expand Down
2 changes: 1 addition & 1 deletion R/PredictMetaLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PredictMetaLayer <- R6Class("PredictMetaLayer",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function(...) {
cat("Class: PredictMetaLayer\n")
Expand Down
2 changes: 1 addition & 1 deletion R/Predicting.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Predicting <- R6Class("Predicting",
#' @description
#' Printer
#'
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
cat(sprintf("Predicting : %s\n", private$id))
Expand Down
4 changes: 2 additions & 2 deletions R/Target.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Target <- R6Class("Target",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
# nocov start
print = function (...) {
Expand All @@ -92,7 +92,7 @@ Target <- R6Class("Target",
# nocov end
#' @description
#' Summary
#' @param ... (any) \cr
#' @param ... `any`
#'
# nocov start
summary = function (...) {
Expand Down
2 changes: 1 addition & 1 deletion R/TestData.R
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ TestData <- R6Class("TestData",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
cat("Class : TestData\n")
Expand Down
2 changes: 1 addition & 1 deletion R/TestLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TestLayer <- R6Class("TestLayer",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...){
cat(sprintf("TestLayer : %s\n", private$id))
Expand Down
2 changes: 1 addition & 1 deletion R/TestMetaLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ TestMetaLayer <- R6Class("TestMetaLayer",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function(...) {
cat(sprintf("TestMetaLayer: %s\n", private$id))
Expand Down
4 changes: 2 additions & 2 deletions R/Testing.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Testing <- R6Class("Testing",
#' @description
#' Printer
#'
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
nb_layers = length(private$hash_table)
Expand Down Expand Up @@ -146,7 +146,7 @@ Testing <- R6Class("Testing",
#' @description
#' UpSet plot to show an overview of the overlap of individuals across various layers.
#'
#' @param ... \cr
#' @param ... `any` \cr
#' Further parameters to be passed to the the \code{upset} function from package \code{UpSetR}.
#'
#' @export
Expand Down
4 changes: 2 additions & 2 deletions R/TrainData.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ TrainData <- R6Class("TrainData",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
if ("TrainMetaLayer" %in% class(private$train_layer)) {
Expand All @@ -124,7 +124,7 @@ TrainData <- R6Class("TrainData",
},
#' @description
#' Summary
#' @param ... (any) \cr
#' @param ... `any`
#'
summary = function (...) {
if ("TrainMetaLayer" %in% class(private$train_layer)) {
Expand Down
2 changes: 1 addition & 1 deletion R/TrainLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TrainLayer <- R6Class("TrainLayer",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...){
if (!private$status) {
Expand Down
4 changes: 3 additions & 1 deletion R/TrainMetaLayer.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ TrainMetaLayer <- R6Class("TrainMetaLayer",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
if (!private$status) {
Expand Down Expand Up @@ -110,7 +110,9 @@ TrainMetaLayer <- R6Class("TrainMetaLayer",
#' Predicts values for the new layer taking as argument.
#'
#' @param new_layer `TrainLayer` \cr
#' A trained TrainLayer object.
#' @param ind_subset `vector` \cr
#' Index subset.
#'
#' @return
#' A new object with the predicted values is returned.
Expand Down
4 changes: 2 additions & 2 deletions R/Training.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Training <- R6Class("Training",
#' @description
#' Printer
#'
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
nb_layers = length(private$hash_table) - 1L
Expand Down Expand Up @@ -736,7 +736,7 @@ Training <- R6Class("Training",
#' @description
#' UpSet plot to show an overview of the overlap of individuals across various layers.
#'
#' @param ... \cr
#' @param ... `any` \cr
#' Further parameters to be passed to the \code{upset} function from package \code{UpSetR}.
#'
#' @export
Expand Down
4 changes: 2 additions & 2 deletions R/VarSel.R
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ VarSel <- R6Class("VarSel",
},
#' @description
#' Printer
#' @param ... (any) \cr
#' @param ... `any`
#'
print = function (...) {
cat(sprintf("VarSel : %s\n", private$id))
Expand All @@ -95,7 +95,7 @@ VarSel <- R6Class("VarSel",
},
#' @description
#' Summary
#' @param ... (any) \cr
#' @param ... `any`
#'
summary = function (...) {
cat(sprintf(" VarSel : %s\n", private$id))
Expand Down
1 change: 0 additions & 1 deletion R/bestLayerLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#' x = data.frame(x1 = runif(n = 50L, min = 0, max = 1))
#' y = sample(x = 0L:1L, size = 50L, replace = TRUE)
#' my_best_model = bestLayerLearner(x = x, y = y)
#'
bestLayerLearner = function (x, y, perf = NULL) {
if (!is.data.frame(x)) {
stop("x must be a data.frame.")
Expand Down
1 change: 0 additions & 1 deletion R/cobra.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
#' @export
#'
#'

cobra = function(x, y, tune = "epsilon", k_folds = NULL, eps = NULL){

# Validate input parameters
Expand Down
1 change: 0 additions & 1 deletion R/createWeights.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#' @param eps A \code{numeric} value representing the threshold for proximity between two predictions.
#' @param alpha A value that determines the optimal number of learners in the neighborhood (only for alpha optimization).
#'

createWeights = function(train, test, n_train, n_test,
nlearners, eps, alpha) {

Expand Down
13 changes: 10 additions & 3 deletions R/predict.bestLayerLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
#' @param object `bestLayerLearner` \cr
#' An object from class [bestLayerLearner]
#' @param data `data.frame` \cr
#' \code{data.frame} to be predicted.
#'
#' New data to predicted.
#' @param ... \code{any}\cr
#' Further arguments passed to or from other methods.
#' @return
#' Predicted target values are returned.
#'
Expand All @@ -25,7 +26,13 @@
#' my_predictions <- predict(object = my_model, data = x_new)
#'
#'
predict.bestLayerLearner = function (object, data) {
predict.bestLayerLearner = function (object, data, ...) {
if (!inherits(object, "bestLayerLearner")) {
stop("'object' must be a 'bestLayerLearner'.")
}
if (!inherits(data, "data.frame")) {
stop("Error: 'newdata' must be an object from the class 'data.frame'.")
}
if (all(names(object) %in% names(data))) {
pred = apply(data[ , names(object), drop = FALSE], 1L, function (tmp_row) {
for (rank in seq_along(object)) {
Expand Down
6 changes: 4 additions & 2 deletions R/predict.weightedMeanLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
#' An object from class [weightedMeanLearner]
#' @param data `data.frame` \cr
#' \code{data.frame} to be predicted.
#' @param na_rm \cr
#' @param na_rm `boolean` \cr
#' Removes NAs when TRUE.
#' @param ... `any` \cr
#' Further arguments.
#'
#' @return
#' Predicted target values are returned.
Expand All @@ -28,7 +30,7 @@
#' x_new <- data.frame(x1 = rnorm(10L))
#' my_predictions <- predict(object = my_model, data = x_new)
#'
predict.weightedMeanLearner = function (object, data, na_rm = FALSE) {
predict.weightedMeanLearner = function (object, data, na_rm = FALSE, ...) {
if (all(names(object) %in% names(data))) {
pred = apply(data[ , names(object), drop = FALSE], 1L, function (tmp_row) {
return(weighted.mean(x = tmp_row, w = object, na.rm = na_rm))
Expand Down
2 changes: 1 addition & 1 deletion R/testingFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ createTestLayer = function (testing,
#'
#' @param object `Testing` \cr
#' The [Testing] object of interest.
#' @param ... \cr
#' @param ... `any` \cr
#' Further arguments.
#'
#' @export
Expand Down
Loading

0 comments on commit 1edeb70

Please sign in to comment.