These three functions can be used for model monitoring (such as in a monitoring dashboard):
vetiver_compute_metrics() computes metrics (such as accuracy for a
classification model or RMSE for a regression model) at a chosen time
aggregation period
vetiver_pin_metrics() updates an existing pin storing model metrics
over time
vetiver_plot_metrics() creates a plot of metrics over time
vetiver_pin_metrics(
board,
df_metrics,
metrics_pin_name,
.index = .index,
overwrite = FALSE,
type = NULL,
...
)A dataframe of metrics.
A pin board, created by board_folder(), board_connect(),
board_url() or another board_ function.
A tidy dataframe of metrics over time, such as created by
vetiver_compute_metrics().
Pin name for where the metrics are stored (as
opposed to where the model object is stored with vetiver_pin_write()).
The variable in df_metrics containing the aggregated dates
or date-times (from time_var in data). Defaults to .index.
If FALSE (the default), error when the new metrics contain
overlapping dates with the existing pin.If TRUE, overwrite any metrics for
dates that exist both in the existing pin and new metrics with the new
values.
File type used to save metrics to disk. With the default NULL,
uses the type of the existing pin. Options are "rds" and "arrow".
Additional arguments passed on to methods for a specific board.
Sometimes when you monitor a model at a given time aggregation, you
may end up with dates in your new metrics (like new_metrics in the example)
that are the same as dates in your existing aggregated metrics (like
original_metrics in the example). This can happen if you need to re-run a
monitoring report because something failed. With overwrite = FALSE (the
default), vetiver_pin_metrics() will error when there are overlapping
dates. With overwrite = TRUE, vetiver_pin_metrics() will replace such
metrics with the new values. You probably want FALSE for interactive use
and TRUE for dashboards or reports that run on a schedule.
You can initially create your pin with type = "arrow" or the default
(type = "rds"). vetiver_pin_metrics() will update the pin using the
same type by default.
vetiver_compute_metrics(), vetiver_plot_metrics()