NAME
PDL::XGBoost - XGBoost gradient boosting C API bindings for PDL
SYNOPSIS
use PDL;
use PDL::XGBoost qw(dmatrix train load_model xgboost_version);
my $X = float([[1, 2], [2, 3], [3, 4], [4, 5]]);
my $y = float([3, 5, 7, 9]);
my $booster = train(
$X, $y,
num_boost_round => 50,
params => {
objective => 'reg:squarederror',
max_depth => 3,
eta => 0.2,
},
);
my $preds = $booster->predict(dmatrix($X));
$booster->save_model('model.ubj');
DESCRIPTION
PDL::XGBoost binds PDL ndarrays directly to XGBoost's pure-C API (xgboost/c_api.h) via C99 XS, enabling fast gradient-boosted decision tree training, inference, and model persistence directly from Perl.
FUNCTIONS
dmatrix
Create a PDL::XGBoost::DMatrix from a 2D PDL feature matrix (and optional 1D label ndarray).
$dm = dmatrix($X);
$dm = dmatrix($X, $y);
train
Train a PDL::XGBoost::Booster for num_boost_round iterations with the given XGBoost parameter hashref.
$booster = train($X, $y, num_boost_round => 50, params => \%params);
load_model
Load a saved XGBoost model (JSON/UBJ) from disk into a PDL::XGBoost::Booster.
$booster = load_model($path);
xgboost_version
Return the linked libxgboost version string (e.g. 3.0.4).
$ver = xgboost_version();
SEE ALSO
PDL, PDL::Torch, PDL::IO::Arrow, PDL::IO::Protobuf
AUTHOR
C.J. Collier <cjac@google.com>
LICENSE
Licensed under the Apache License, Version 2.0.