# \donttest{
set.seed(42)
n_obs <- 50
X_toy <- data.frame(
FeatureA = rnorm(n_obs),
FeatureB = runif(n_obs, 0, 100)
)
y_toy <- factor(sample(c("Control", "Case"), n_obs, replace = TRUE),
levels = c("Control", "Case"))
ids_toy <- paste0("Sample", 1:n_obs)
# 2. Train a model
rf_model <- rf_dia(X_toy, y_toy)
# 3. Evaluate the model using F1-score optimal threshold
eval_results <- evaluate_model_dia(
model_obj = rf_model,
X_data = X_toy,
y_data = y_toy,
sample_ids = ids_toy,
threshold_choices = "f1",
pos_class = "Case",
neg_class = "Control"
)
str(eval_results)
# }
Run the code above in your browser using DataLab