plot.deepregression {deepregression} | R Documentation |

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 class '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 class 'deepregression'
predict(
object,
newdata = NULL,
batch_size = NULL,
apply_fun = tfd_mean,
convert_fun = as.matrix,
...
)
## S3 method for class 'deepregression'
fitted(object, apply_fun = tfd_mean, ...)
## S3 method for class '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(),
convertfun = function(x) tf$constant(x, dtype = "float32"),
...
)
## S3 method for class 'deepregression'
coef(object, which_param = 1, type = NULL, ...)
## S3 method for class 'deepregression'
print(x, ...)
## S3 method for class '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 class 'deepregression'
mean(x, data = NULL, ...)
## S3 method for class 'deepregression'
stddev(x, data = NULL, ...)
## S3 method for class 'deepregression'
quant(x, data = NULL, probs, ...)
```

`x` |
a deepregression object |

`which` |
character vector or number(s) identifying the effect to plot; default plots all effects |

`which_param` |
integer, indicating for which distribution parameter coefficients should be returned (default is first parameter) |

`only_data` |
logical, if TRUE, only the data for plotting is returned |

`grid_length` |
the length of an equidistant grid at which a two-dimensional function is evaluated for plotting. |

`main_multiple` |
vector of strings; plot main titles if multiple plots are selected |

`type` |
either NULL (all types of coefficients are returned), "linear" for linear coefficients or "smooth" for coefficients of smooth terms |

`get_weight_fun` |
function to extract weight from model given |

`...` |
arguments passed to the |

`object` |
a deepregression model |

`newdata` |
optional new data, either data.frame or list |

`batch_size` |
integer, the batch size used for mini-batch training |

`apply_fun` |
function applied to fitted distribution,
per default |

`convert_fun` |
how should the resulting tensor be converted,
per default |

`epochs` |
integer, the number of epochs to fit the model |

`early_stopping` |
logical, whether early stopping should be user. |

`early_stopping_metric` |
character, based on which metric should early stopping be trigged (default: "val_loss") |

`verbose` |
whether to print training in each fold |

`view_metrics` |
logical, whether to trigger the Viewer in RStudio / Browser. |

`patience` |
number of patience for early stopping |

`save_weights` |
logical, whether to save weights in each epoch. |

`validation_data` |
optional specified validation data |

`validation_split` |
float in [0,1] defining the amount of data used for validation |

`callbacks` |
a list of callbacks used for fitting |

`convertfun` |
function to convert R into Tensor object |

`plot` |
whether to plot the resulting losses in each fold |

`print_folds` |
whether to print the current fold |

`cv_folds` |
an integer; can also be a list of lists with train and test data sets per fold |

`stop_if_nan` |
logical; whether to stop CV if NaN values occur |

`mylapply` |
lapply function to be used; defaults to |

`save_fun` |
function applied to the model in each fold to be stored in the final result |

`data` |
either |

`probs` |
the quantile value(s) |

Returns an object `drCV`

, a list, one list element for each fold
containing the model fit and the `weighthistory`

.

[Package *deepregression* version 1.0.0 Index]