tf_compile_model {reservr} | R Documentation |
Compile a Keras model for truncated data under dist
Description
Compile a Keras model for truncated data under dist
Usage
tf_compile_model(
inputs,
intermediate_output,
dist,
optimizer,
censoring = TRUE,
truncation = TRUE,
metrics = NULL,
weighted_metrics = NULL
)
Arguments
inputs |
List of keras input layers |
intermediate_output |
Intermediate model layer to be used as input to distribution parameters |
dist |
A |
optimizer |
String (name of optimizer) or optimizer instance. See
|
censoring |
A flag, whether the compiled model should support censored
observations. Set to |
truncation |
A flag, whether the compiled model should support truncated
observations. Set to |
metrics |
List of metrics to be evaluated by the model during training and testing. Each of these can be:
Typically you will use
If providing an anonymous R function, you can customize the printed name
during training by assigning |
weighted_metrics |
List of metrics to be evaluated and weighted by
|
Value
A reservr_keras_model
that can be used to train truncated
and censored observations from dist
based on input data from inputs
.
Examples
dist <- dist_exponential()
params <- list(rate = 1.0)
N <- 100L
rand_input <- runif(N)
x <- dist$sample(N, with_params = params)
if (interactive()) {
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
)
}