Converts scratch/tune_model.R into a pure tune_lgbm() function, replacing hardcoded winning_params with a fully automated tar_target. Best params (trees=844, depth=3, lr=0.0204, min_n=389) now flow reproducibly into evaluate_final_model() and train_production_model(). PR-AUC improved from 0.165 to 0.198. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
40 lines
1.2 KiB
R
40 lines
1.2 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/functions.R
|
|
\name{tune_lgbm}
|
|
\alias{tune_lgbm}
|
|
\title{Tune LightGBM Hyperparameters}
|
|
\usage{
|
|
tune_lgbm(
|
|
imbalance_windows,
|
|
bucket_name = "baf-fraud",
|
|
inputs_prefix = "05_model_input",
|
|
grid_size = 30L,
|
|
seed = 42L
|
|
)
|
|
}
|
|
\arguments{
|
|
\item{imbalance_windows}{A tibble with columns \code{window_id},
|
|
\code{train_months}, and \code{test_month}, as produced by the
|
|
\code{imbalance_windows} target.}
|
|
|
|
\item{bucket_name}{Character. MinIO bucket name. Default \code{"baf-fraud"}.}
|
|
|
|
\item{inputs_prefix}{Character. Prefix for the model input layer.
|
|
Default \code{"05_model_input"}.}
|
|
|
|
\item{grid_size}{Integer. Number of space-filling candidates. Default \code{30}.}
|
|
|
|
\item{seed}{Integer. Random seed for reproducibility. Default \code{42}.}
|
|
}
|
|
\value{
|
|
A named list with elements \code{trees}, \code{tree_depth},
|
|
\code{learn_rate}, and \code{min_n}.
|
|
}
|
|
\description{
|
|
Performs a grid search over LightGBM hyperparameters using the same rolling
|
|
time windows as the imbalance tournament. Optimises PR-AUC on the pre-baked
|
|
baseline data stored in MinIO. Returns the best parameters as a named list
|
|
ready for use in \code{evaluate_final_model()} and
|
|
\code{train_production_model()}.
|
|
}
|