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.7.2 |
Built: | 2024-12-29 07:56:27 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 )
name
name of the class
type
type of supervised learning method implemented
model
fitted model
method
supevised learning method
X_train
training set features
y_train
training set response
pi_method
type of prediction interval in c("splitconformal", "kdesplitconformal", "bootsplitconformal", "jackknifeplus", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus")
level
an integer; the level of confidence
B
an integer; the number of simulations when level
is not NULL
nb_hidden
number of nodes in the hidden layer, for construction of a quasi- randomized network
nodes_sim
type of 'simulations' for hidden nodes, if nb_hidden
> 0;
takes values in c("sobol", "halton", "unif")
activ
activation 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")
engine
contains fit and predict lower-level methods for the given method
;
do not modify by hand
params
additional parameters passed to method
when calling fit
seed
an 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)
deep
Whether to make a deep clone.
Classifier
classThe Classifier
class contains supervised classification models
This class implements models:
Linear model
see https://www.researchgate.net/publication/380760578_Boosted_Configuration_neural_Networks_for_supervised_classification
Extremely Randomized Trees; see https://link.springer.com/article/10.1007/s10994-006-6226-1
Elastic Net Regression; see https://glmnet.stanford.edu/
Kernel Ridge Regression; see for example https://www.jstatsoft.org/article/view/v079i03
(but the implementation is different)
Random Forest; see https://www.jstatsoft.org/article/view/v077i01
Ridge regression; see https://arxiv.org/pdf/1509.09169
a scalable tree boosting system see https://arxiv.org/abs/1603.02754
Random Vector Functional Network, see https://www.researchgate.net/publication/332292006_Online_Bayesian_Quasi-Random_functional_link_networks_application_to_the_optimization_of_black_box_functions
learningmachine::Base
-> Classifier
name
name of the class
type
type of supervised learning method implemented
model
fitted model
method
supervised learning method in c('lm', 'ranger', 'extratrees', 'ridge', 'bcn', 'glmnet', 'krr', 'xgboost')
X_train
training set features; do not modify by hand
y_train
training set response; do not modify by hand
pi_method
type of prediction set in c("splitconformal", "kdesplitconformal", "bootsplitconformal", "surrsplitconformal")
level
an integer; the level of confidence (default is 95, for 95 per cent) for prediction sets
type_prediction_set
a string; the type of prediction set (currently, only "score" method)
B
an integer; the number of simulations when level
is not NULL
nb_hidden
number of nodes in the hidden layer, for construction of a quasi- randomized network
nodes_sim
type of 'simulations' for hidden nodes, if nb_hidden
> 0;
takes values in c("sobol", "halton", "unif")
activ
activation 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")
engine
contains fit and predic lower-level methods for the given method
;
do not modify by hand
params
additional parameters passed to method
when calling fit
do not modify by hand
seed
an integer; reproducibility seed for methods that include randomization
learningmachine::Base$get_B()
learningmachine::Base$get_activ()
learningmachine::Base$get_engine()
learningmachine::Base$get_level()
learningmachine::Base$get_method()
learningmachine::Base$get_model()
learningmachine::Base$get_name()
learningmachine::Base$get_nb_hidden()
learningmachine::Base$get_nodes_sim()
learningmachine::Base$get_params()
learningmachine::Base$get_pi_method()
learningmachine::Base$get_seed()
learningmachine::Base$get_type()
learningmachine::Base$set_B()
learningmachine::Base$set_activ()
learningmachine::Base$set_engine()
learningmachine::Base$set_level()
learningmachine::Base$set_method()
learningmachine::Base$set_model()
learningmachine::Base$set_nb_hidden()
learningmachine::Base$set_nodes_sim()
learningmachine::Base$set_pi_method()
learningmachine::Base$set_seed()
learningmachine::Base$summary()
new()
Create a new object.
Classifier$new( name = "Classifier", type = "classification", model = NULL, method = NULL, X_train = NULL, y_train = NULL, pi_method = c("none", "kdesplitconformal", "bootsplitconformal", "surrsplitconformal"), level = 95, type_prediction_set = c("none", "score"), 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 )
A new Classifier
object.
get_type_prediction_set()
Classifier$get_type_prediction_set()
set_type_prediction_set()
Classifier$set_type_prediction_set(type_prediction_set)
fit()
Fit model to training set
Classifier$fit(X, y, ...)
X
a matrix of covariates (i.e explanatory variables)
y
a vector, the response (i.e variable to be explained)
...
additional parameters to learning algorithm (see vignettes)
predict_proba()
Classifier$predict_proba(X)
predict()
Classifier$predict(X)
clone()
The objects of this class are cloneable with this method.
Classifier$clone(deep = FALSE)
deep
Whether to make a deep clone.
Regressor
classThe Regressor
class contains supervised regression models
This class implements models:
Linear model
see https://www.researchgate.net/publication/380760578_Boosted_Configuration_neural_Networks_for_supervised_classification
Extremely Randomized Trees; see https://link.springer.com/article/10.1007/s10994-006-6226-1
Elastic Net Regression; see https://glmnet.stanford.edu/
Kernel Ridge Regression; see for example https://www.jstatsoft.org/article/view/v079i03
(but the implementation is different)
Random Forest; see https://www.jstatsoft.org/article/view/v077i01
Ridge regression; see https://arxiv.org/pdf/1509.09169
a scalable tree boosting system see https://arxiv.org/abs/1603.02754
Support Vector Machines, see https://cran.r-project.org/web/packages/e1071/vignettes/svmdoc.pdf
Random Vector Functional Network, see https://www.researchgate.net/publication/332292006_Online_Bayesian_Quasi-Random_functional_link_networks_application_to_the_optimization_of_black_box_functions
learningmachine::Base
-> Regressor
name
name of the class
type
type of supervised learning method implemented
model
fitted model
method
supervised learning method in c('lm', 'ranger', 'extratrees', 'ridge', 'bcn', 'glmnet', 'krr', 'xgboost', 'svm')
X_train
training set features; do not modify by hand
y_train
training set response; do not modify by hand
pi_method
type of prediction interval in c("splitconformal", "kdesplitconformal", "bootsplitconformal", "jackknifeplus", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus")
level
an integer; the level of confidence (default is 95, for 95 per cent) for prediction intervals
B
an integer; the number of simulations when 'level' is not NULL
nb_hidden
number of nodes in the hidden layer, for construction of a quasi- randomized network
nodes_sim
type of 'simulations' for hidden nodes, if nb_hidden
> 0;
takes values in c("sobol", "halton", "unif")
activ
activation 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")
engine
contains fit and predic lower-level methods for the given method
;
do not modify by hand
params
additional parameters passed to method
when calling fit
do not modify by hand
seed
an integer; reproducibility seed for methods that include randomization
learningmachine::Base$get_B()
learningmachine::Base$get_activ()
learningmachine::Base$get_engine()
learningmachine::Base$get_level()
learningmachine::Base$get_method()
learningmachine::Base$get_model()
learningmachine::Base$get_name()
learningmachine::Base$get_nb_hidden()
learningmachine::Base$get_nodes_sim()
learningmachine::Base$get_params()
learningmachine::Base$get_pi_method()
learningmachine::Base$get_seed()
learningmachine::Base$get_type()
learningmachine::Base$set_B()
learningmachine::Base$set_activ()
learningmachine::Base$set_engine()
learningmachine::Base$set_level()
learningmachine::Base$set_method()
learningmachine::Base$set_model()
learningmachine::Base$set_nb_hidden()
learningmachine::Base$set_nodes_sim()
learningmachine::Base$set_pi_method()
learningmachine::Base$set_seed()
learningmachine::Base$summary()
new()
Create a new object.
Regressor$new( name = "Regressor", type = "regression", model = NULL, method = NULL, X_train = NULL, y_train = NULL, 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 )
A new Regressor
object.
fit()
Fit model to training set
Regressor$fit(X, y, type_split = c("stratify", "sequential"), ...)
X
a matrix of covariates (i.e explanatory variables)
y
a vector, the response (i.e variable to be explained)
type_split
type of data splitting for split conformal prediction: "stratify" (for classical supervised learning) "sequential" (when the data sequential ordering matters)
...
additional parameters to learning algorithm (see vignettes)
predict()
Predict model on test set
Regressor$predict(X, ...)
X
a matrix of covariates (i.e explanatory variables)
...
additional parameters
fit_predict()
Fit model to training set and predict on test set
Regressor$fit_predict( X, y, pct_train = 0.8, score = ifelse(is.factor(y), yes = function(preds, y_test) mean(preds == y_test), no = function(preds, y_test) sqrt(mean((preds - y_test)^2))), level = NULL, pi_method = c("none", "splitconformal", "jackknifeplus", "kdesplitconformal", "bootsplitconformal", "kdejackknifeplus", "bootjackknifeplus", "surrsplitconformal", "surrjackknifeplus"), B = 100, seed = 123, graph = FALSE, ... )
update()
update model in an online fashion (for now, only implemented for 'rvfl' models")
Regressor$update(newx, newy, ...)
newx
a vector of new covariates (i.e explanatory variables)
newy
a numeric, the new response's observation (i.e variable to be explained)
...
additional parameters to be passed to the underlying model's method update
clone()
The objects of this class are cloneable with this method.
Regressor$clone(deep = FALSE)
deep
Whether to make a deep clone.