| Title: | Machine Learning with Explanations and Uncertainty Quantification |
|---|---|
| Description: | Regression-based Machine Learning with explanations and uncertainty quantification. |
| Authors: | T. Moudiki |
| Maintainer: | T. Moudiki <[email protected]> |
| License: | BSD_3_clause + file LICENSE |
| Version: | 2.9.0 |
| Built: | 2026-05-23 09:13:10 UTC |
| Source: | https://github.com/Techtonique/learningmachine |
Base classthe Base class used by other objects; useful
for extensions of the package, not for basic
interactions with the package
new()
Create a new object.
Base$new(
name = "Base",
type = "none",
model = NULL,
method = NULL,
X_train = NULL,
y_train = NULL,
pi_method = c("none", "splitconformal", "kdesplitconformal", "bootsplitconformal",
"jackknifeplus", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal",
"surrjackknifeplus"),
level = 95,
B = 100,
nb_hidden = 0,
nodes_sim = c("sobol", "halton", "unif"),
activ = c("relu", "sigmoid", "tanh", "leakyrelu", "elu", "linear"),
engine = NULL,
params = NULL,
seed = 123
)namename of the class
typetype of supervised learning method implemented
modelfitted model
methodsupevised learning method
X_traintraining set features
y_traintraining set response
pi_methodtype of prediction interval in c("splitconformal", "kdesplitconformal", "bootsplitconformal", "jackknifeplus", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus")
levelan integer; the level of confidence
Ban integer; the number of simulations when level is not NULL
nb_hiddennumber of nodes in the hidden layer, for construction of a quasi- randomized network
nodes_simtype of 'simulations' for hidden nodes, if nb_hidden > 0;
takes values in c("sobol", "halton", "unif")
activactivation function's name for the hidden layer, in the construction of a quasi-randomized network; takes values in c("relu", "sigmoid", "tanh", " leakyrelu", "elu", "linear")
enginecontains fit and predict lower-level methods for the given method;
do not modify by hand
paramsadditional parameters passed to method when calling fit
seedan integer; reproducibility seed for methods that include randomization
A new Base object.
get_name()
Base$get_name()
get_type()
Base$get_type()
get_model()
Base$get_model()
set_model()
Base$set_model(model)
get_method()
Base$get_method()
set_method()
Base$set_method(method)
get_pi_method()
Base$get_pi_method()
set_pi_method()
Base$set_pi_method(pi_method)
get_level()
Base$get_level()
set_level()
Base$set_level(level)
get_B()
Base$get_B()
set_B()
Base$set_B(B)
get_nb_hidden()
Base$get_nb_hidden()
set_nb_hidden()
Base$set_nb_hidden(nb_hidden)
get_nodes_sim()
Base$get_nodes_sim()
set_nodes_sim()
Base$set_nodes_sim(nodes_sim)
get_activ()
Base$get_activ()
set_activ()
Base$set_activ(activ)
set_engine()
Base$set_engine(engine)
get_engine()
Base$get_engine()
get_params()
Base$get_params()
get_seed()
Base$get_seed()
set_seed()
Base$set_seed(seed)
summary()
Base$summary(
X,
show_progress = TRUE,
class_name = NULL,
class_index = NULL,
y = NULL,
type_ci = c("student", "nonparametric", "bootstrap", "conformal"),
cl = NULL
)clone()
The objects of this class are cloneable with this method.
Base$clone(deep = FALSE)
deepWhether to make a deep clone.
Create a classifier object for Probabilistic Machine Learning
classifier( x, y, model = c("ranger", "extratrees", "ridge", "bcn", "glmnet", "krr", "xgboost", "svm"), pi_method = c("none", "splitconformal", "jackknifeplus", "kdesplitconformal", "bootsplitconformal", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus"), level = 95, B = 100, nb_hidden = 0, nodes_sim = c("sobol", "halton", "unif"), activ = c("relu", "sigmoid", "tanh", "leakyrelu", "elu", "linear"), engine = NULL, params = NULL, seed = 123 )classifier( x, y, model = c("ranger", "extratrees", "ridge", "bcn", "glmnet", "krr", "xgboost", "svm"), pi_method = c("none", "splitconformal", "jackknifeplus", "kdesplitconformal", "bootsplitconformal", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus"), level = 95, B = 100, nb_hidden = 0, nodes_sim = c("sobol", "halton", "unif"), activ = c("relu", "sigmoid", "tanh", "leakyrelu", "elu", "linear"), engine = NULL, params = NULL, seed = 123 )
x |
Input matrix or data frame of features |
y |
Vector of target values |
model |
Model to use for classification |
pi_method |
Method to use for conformal prediction |
level |
Confidence level for conformal prediction |
B |
Number of simulations for conformal prediction |
|
Number of nodes in the hidden layer |
|
nodes_sim |
Type of simulations for hidden nodes |
activ |
Activation function for hidden layer |
engine |
Engine to use for fitting the model |
params |
Additional parameters passed to the model |
seed |
Reproducibility seed for randomization |
... |
Additional arguments passed to Classifier$new() |
A classifier object of class "classifier"
set.seed(43) X <- as.matrix(iris[, 1:4]) y <- iris$Species index_train <- base::sample.int(n = nrow(X), size = floor(0.8*nrow(X)), replace = FALSE) X_train <- X[index_train, ] y_train <- y[index_train] X_test <- X[-index_train, ] y_test <- y[-index_train] dim(X_train) dim(X_test) obj <- classifier(X_train, y_train) preds <- predict(obj, X_test)set.seed(43) X <- as.matrix(iris[, 1:4]) y <- iris$Species index_train <- base::sample.int(n = nrow(X), size = floor(0.8*nrow(X)), replace = FALSE) X_train <- X[index_train, ] y_train <- y[index_train] X_test <- X[-index_train, ] y_test <- y[-index_train] dim(X_train) dim(X_test) obj <- classifier(X_train, y_train) preds <- predict(obj, X_test)
Predict using a regressor object
## S3 method for class 'regressor' predict(object, newx, ...)## S3 method for class 'regressor' predict(object, newx, ...)
object |
A regressor object |
newx |
Matrix or data frame of new observations |
... |
Additional arguments (not used) |
Vector of predicted values
Create a regressor object for Probabilistic Machine Learning
regressor( x, y, model = c("ranger", "extratrees", "ridge", "bcn", "glmnet", "krr", "xgboost", "svm"), pi_method = c("none", "splitconformal", "jackknifeplus", "kdesplitconformal", "bootsplitconformal", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus"), level = 95, B = 100, nb_hidden = 0, nodes_sim = c("sobol", "halton", "unif"), activ = c("relu", "sigmoid", "tanh", "leakyrelu", "elu", "linear"), engine = NULL, params = NULL, type_split = c("stratify", "sequential"), seed = 123 )regressor( x, y, model = c("ranger", "extratrees", "ridge", "bcn", "glmnet", "krr", "xgboost", "svm"), pi_method = c("none", "splitconformal", "jackknifeplus", "kdesplitconformal", "bootsplitconformal", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus"), level = 95, B = 100, nb_hidden = 0, nodes_sim = c("sobol", "halton", "unif"), activ = c("relu", "sigmoid", "tanh", "leakyrelu", "elu", "linear"), engine = NULL, params = NULL, type_split = c("stratify", "sequential"), seed = 123 )
x |
Input matrix or data frame of features |
y |
Vector of target values |
model |
Model to use for regression |
pi_method |
Method to use for conformal prediction |
level |
Confidence level for conformal prediction |
B |
Number of simulations for conformal prediction |
|
Number of nodes in the hidden layer |
|
nodes_sim |
Type of simulations for hidden nodes |
activ |
Activation function for hidden layer |
engine |
Engine to use for fitting the model |
params |
Additional parameters passed to the model |
type_split |
Type of data splitting for split conformal prediction: "stratify" (for classical supervised learning) "sequential" (when the data sequential ordering matters) |
seed |
Reproducibility seed for randomization |
... |
Additional arguments passed to Regressor$new() |
A regressor object of class "regressor"
X <- mtcars[, -1] y <- mtcars$mpg X_train <- X[1:25, ] y_train <- y[1:25] X_test <- X[26:32, ] y_test <- y[26:32] reg <- regressor(X_train, y_train, pi_method = "splitconformal", level = 95) print(predict(reg, newx = X_test))X <- mtcars[, -1] y <- mtcars$mpg X_train <- X[1:25, ] y_train <- y[1:25] X_test <- X[26:32, ] y_test <- y[26:32] reg <- regressor(X_train, y_train, pi_method = "splitconformal", level = 95) print(predict(reg, newx = X_test))