predict.reservr_keras_model {reservr} | R Documentation |
Predict individual distribution parameters
Description
Predict individual distribution parameters
Usage
## S3 method for class 'reservr_keras_model'
predict(object, data, as_matrix = FALSE, ...)
Arguments
object |
A compiled and trained |
data |
Input data compatible with the model. |
as_matrix |
Return a parameter matrix instead of a list structure? |
... |
ignored |
Value
A parameter list suitable for the with_params
argument of the distribution family used for the model.
Contains one set of parameters per row in data
.
Examples
if (interactive()) {
dist <- dist_exponential()
params <- list(rate = 1.0)
N <- 100L
rand_input <- runif(N)
x <- dist$sample(N, with_params = params)
tf_in <- keras3::layer_input(1L)
mod <- tf_compile_model(
inputs = list(tf_in),
intermediate_output = tf_in,
dist = dist,
optimizer = keras3::optimizer_adam(),
censoring = FALSE,
truncation = FALSE
)
tf_fit <- fit(
object = mod,
x = k_matrix(rand_input),
y = x,
epochs = 10L,
callbacks = list(
callback_debug_dist_gradients(mod, k_matrix(rand_input), x)
)
)
tf_preds <- predict(mod, data = k_matrix(rand_input))
}
[Package reservr version 0.0.3 Index]