## ----setup, include=FALSE-----------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
options(gp3ml.reproducible_examples = TRUE)
library(gp3ml)

## ----task---------------------------------------------------------------------
data <- simulate_gazepoint_governed_data(18L, 6L, 1L, seed = 2201L)
predictors <- c("fixation_duration", "gaze_dispersion", "pupil_change")
task <- create_gazepoint_synthetic_task(
  data, "assigned_condition", "new_participants"
)
manifest <- create_gazepoint_synthetic_manifest(task$outcome, predictors)
folds <- create_gazepoint_group_folds(
  data, task$outcome, predictors, manifest,
  task$generalization_target,
  task$participant_id, task$unit_id, task$stimulus_id,
  v = 3L, repeats = 1L, seed = 2201L
)

## ----tune---------------------------------------------------------------------
grid <- create_gazepoint_tuning_grid(
  engine = "glm",
  preprocessor_grid = list(center = c(TRUE, FALSE), scale = TRUE),
  thresholds = c(0.45, 0.55),
  complexity = "low",
  interpretability = "high"
)
tuning <- tune_gazepoint_model(
  folds, task, grid, predictors = predictors, seed = 2201L
)
compare_gazepoint_models(tuning, c("roc_auc", "balanced_accuracy", "brier"))

