Generic functions for deepregression models
Predict based on a deepregression object
Function to extract fitted distribution
Fit a deepregression model (pendant to fit for keras)
Extract layer weights / coefficients from model
Print function for deepregression model
Cross-validation for deepgression objects
mean of model fit
Standard deviation of fit distribution
Calculate the distribution quantiles
# S3 method for deepregression
plot(
x,
which = NULL,
which_param = 1,
only_data = FALSE,
grid_length = 40,
main_multiple = NULL,
type = "b",
get_weight_fun = get_weight_by_name,
...
)# S3 method for deepregression
predict(
object,
newdata = NULL,
batch_size = NULL,
apply_fun = tfd_mean,
convert_fun = as.matrix,
...
)
# S3 method for deepregression
fitted(object, apply_fun = tfd_mean, ...)
# S3 method for deepregression
fit(
object,
batch_size = 32,
epochs = 10,
early_stopping = FALSE,
early_stopping_metric = "val_loss",
verbose = TRUE,
view_metrics = FALSE,
patience = 20,
save_weights = FALSE,
validation_data = NULL,
validation_split = ifelse(is.null(validation_data), 0.1, 0),
callbacks = list(),
na_handler = na_omit_list,
...
)
# S3 method for deepregression
coef(object, which_param = 1, type = NULL, ...)
# S3 method for deepregression
print(x, ...)
# S3 method for deepregression
cv(
x,
verbose = FALSE,
patience = 20,
plot = TRUE,
print_folds = TRUE,
cv_folds = 5,
stop_if_nan = TRUE,
mylapply = lapply,
save_weights = FALSE,
callbacks = list(),
save_fun = NULL,
...
)
# S3 method for deepregression
mean(x, data = NULL, ...)
# S3 method for deepregression
stddev(x, data = NULL, ...)
# S3 method for deepregression
quant(x, data = NULL, probs, ...)
Returns an object drCV
, a list, one list element for each fold
containing the model fit and the weighthistory
.
a deepregression object
character vector or number(s) identifying the effect to plot; default plots all effects
integer, indicating for which distribution parameter coefficients should be returned (default is first parameter)
logical, if TRUE, only the data for plotting is returned
the length of an equidistant grid at which a two-dimensional function is evaluated for plotting.
vector of strings; plot main titles if multiple plots are selected
either NULL (all types of coefficients are returned), "linear" for linear coefficients or "smooth" for coefficients of smooth terms
function to extract weight from model given x
,
a name
and param_nr
arguments passed to the predict
function
a deepregression model
optional new data, either data.frame or list
integer, the batch size used for mini-batch training
function applied to fitted distribution,
per default tfd_mean
how should the resulting tensor be converted,
per default as.matrix
integer, the number of epochs to fit the model
logical, whether early stopping should be user.
character, based on which metric should early stopping be trigged (default: "val_loss")
whether to print training in each fold
logical, whether to trigger the Viewer in RStudio / Browser.
number of patience for early stopping
logical, whether to save weights in each epoch.
optional specified validation data
float in [0,1] defining the amount of data used for validation
a list of callbacks used for fitting
function to deal with NAs
whether to plot the resulting losses in each fold
whether to print the current fold
an integer; can also be a list of lists with train and test data sets per fold
logical; whether to stop CV if NaN values occur
lapply function to be used; defaults to lapply
function applied to the model in each fold to be stored in the final result
either NULL
or a new data set
the quantile value(s)