Base class for Adaptive discrete smoothing.
R6::R6Class object.
data
(data.frame()
)
Data frame.
learner
(LearnerRegr
)
A learner.
task_list
(list()
)
A list of tasks.
learner_list
(list()
)
A list of learners.
delta
(numeric()
)
A vector.
gamma
(numeric()
)
A vector.
weight_path
(array()
)
An array.
predictions
(array()
)
An array.
new()
Initialize a ADS Class object.
ADS$new( data, target, individ, learner, delta = 0.7, gamma = 1, iterations = 2, W_start = NULL, calc_dist = list(fun = calc_dist_default), calc_weight = list(fun = calc_weight_default, params = list(kernel = "gaussian")) )
data
(data.frame()
)
Data.frame containing the target variable, the covariates and a column with the corresponding individuals.
target
(character(1)
)
Name of the target variable.
individ
(character(1)
)
Name of the column with the individuals. Column has to be a factor.
learner
(LearnerRegr
)
The machine learners from the mlr3
-package.
delta
(numeric()
)
Parameter for the loss function
gamma
(gamma()
)
Parameter for the loss function
iterations
(integer(1)
)
Number of iterations.
W_start
(matrix()
)
Starting weights. Default is the identity matrix.
calc_dist
(function()
)
A list. If not set to default a list with the following components:
fun
A function of the form function(model_1,model_2,task_list,...)
to calculate the weights.
params
A list of the additional parameters used in fun
.
calc_weight
(function()
)
A list. If not set to default a list with the following components:
fun
A function of the form function(dist, delta, gamma,...)
to calculate the weights.
params
A list of the additional parameters used in fun
.
print()
Print ADS objects.
ADS$print()
fit()
Estimate ADS models.
ADS$fit(store_predictions = FALSE)
store_predictions
(logical(1)
)
Indicates whether the predictions should be
stored in field predictions_
. Default is FALSE
.
self
predict()
Predict ADS models on new data.
ADS$predict(newdata, iterations = NULL)
newdata
(data.frame()
)
Predicts the model on new data. Has to be a data.frame with the same columns as in the trained model.
iterations
(vector()
)
Specifies the iterations to predict. Defaults to all iterations.
An array containing the predicted values over different iterations.
calc_mse()
Calculate the mean squared error for indiviuals over different iterations.
ADS$calc_mse(newdata)
newdata
(data.frame()
)
Calculate the mean squared error on new data. Has to be a data.frame with the same columns as in the trained model.
A list containing the mean squared error for indiviudals and the combined model.
plot_mse()
Plot the mean squeared error over the iterations. At iteration zero, all predictions are initialized to be zero.
ADS$plot_mse( newdata = NULL, individuals = NULL, iterations = NULL, interactive = TRUE )
newdata
(data.frame()
)
Plot the mean squared error out-of-sample. Has to be a data.frame with the same columns as in the trained model.
individuals
(character()
)
Individuals to plot the weights for. Defaults to all individuals.
iterations
(integer()
)
Steps to plot the weights for. Defaults to all iterations.
interactive
(logical(1)
)
Create an interactive plot with plotly
.
list
heatmap()
Plot the used weights as a heatmap.
ADS$heatmap( individuals = NULL, iterations = NULL, interactive = TRUE, show_axis_text = TRUE )
individuals
(character()
)
Individuals to plot the weights for. Defaults to all individuals.
iterations
(integer()
)
Steps to plot the weights for. Defaults to all iterations.
interactive
(logical(1)
)
Create an interactive plot with plotly
.
show_axis_text
(logical(1)
)
Show axis tick text.
list
clone()
The objects of this class are cloneable with this method.
ADS$clone(deep = FALSE)
deep
Whether to make a deep clone.