plot_hyperparams_traceplot {BKTR}R Documentation

Plot Hyperparameters Traceplot

Description

Plot the evolution of hyperparameters through iterations. (Traceplot)

Usage

plot_hyperparams_traceplot(
  bktr_reg,
  hyperparameters = NULL,
  show_figure = TRUE,
  fig_width = 9,
  fig_height = 5.5,
  fig_resolution = 200
)

Arguments

bktr_reg

BKTRRegressor: BKTRRegressor object.

hyperparameters

Array or NULL: Array of hyperparameters to plot. If NULL, plot all hyperparameters. Defaults to NULL.

show_figure

Boolean: Whether to show the figure. Defaults to True.

fig_width

Integer: Figure width. Defaults to 9.

fig_height

Integer: Figure height. Defaults to 5.5.

fig_resolution

Numeric: Figure resolution PPI. Defaults to 200.

Value

ggplot or NULL: ggplot object or NULL if show_figure is set to FALSE.

Examples


# Launch MCMC sampling on a light version of the BIXI dataset
bixi_data <- BixiData$new(is_light = TRUE)
k_matern <- KernelMatern$new()
k_periodic <- KernelPeriodic$new()
bktr_regressor <- BKTRRegressor$new(
  data_df <- bixi_data$data_df,
  spatial_kernel = k_matern,
  temporal_kernel = k_periodic,
  spatial_positions_df = bixi_data$spatial_positions_df,
  temporal_positions_df = bixi_data$temporal_positions_df,
  burn_in_iter = 5, sampling_iter = 10) # For example only (too few iterations)
bktr_regressor$mcmc_sampling()

# Plot the traceplot of all hyperparameters
plot_hyperparams_traceplot(bktr_regressor)

# Plot the traceplot of the spatial kernel hyperparameters
spa_par_name <- paste0('Spatial - ', k_matern$parameters[[1]]$full_name)
plot_hyperparams_traceplot(bktr_regressor, spa_par_name)

# Plot the traceplot of the temporal kernel hyperparameters
temp_par_names <- sapply(k_periodic$parameters, function(x) x$full_name)
temp_par_names <- paste0('Temporal - ', temp_par_names)
plot_hyperparams_traceplot(bktr_regressor, temp_par_names)


[Package BKTR version 0.1.1 Index]