package modelkit-xgboost

  1. Overview
  2. Docs

Module Modelkit_xgboost.ClassifierSource

Binary and multiclass CPU histogram-tree classification.

Sourcetype fitted
Sourcetype report = {
  1. rounds : int;
  2. native_version : int * int * int;
  3. native_seed : int64;
  4. class_count : int;
  5. training_rows : int;
  6. effective_rows : int;
  7. feature_conversion : Input.report;
  8. target_conversion : Input.report;
  9. weight_conversion : Input.report option;
}
Sourceval report : fitted -> report

Records original/effective row counts and conversion allocations. Shapes describe the original inputs; retained buffers contain positively weighted rows only. Full-input float32 staging and row-index arrays are reported separately. Mapping tables, class storage, native allocations, and the temporary cache-detachment model buffer are excluded.

Sourceval classes : fitted -> int array

A fresh copy of the sorted original integer labels. Only classes with positive sample weight enter the fitted vocabulary. Labels are mapped to contiguous native indices, preserving values beyond float32 precision.

Specifications are created with Specification.create. At least two positively weighted classes are required; empty, single-class, and single-effective-class targets return typed validation errors. Two effective classes use binary logistic loss; three or more use multiclass softmax cross-entropy. Class count is bounded by exact float32 index representation. Zero-weight rows are removed before native training; numeric admission still validates their features. Native feature NaNs remain missing values.

Prediction returns original labels in row order. Probability ties select the lowest label, including the binary probability-0.5 tie. Schema, native lifetime, concurrency, version-dependent reproducibility, and thread contracts match Regressor. Empty prediction batches are supported.

include Modelkit.CLASSIFIER with type t := t and type params := params and type fitted := fitted and type rng = Modelkit.Rng.t

Finite float64 probabilities with one column per entry in classes. Binary columns are one-minus-positive-probability and positive probability for the lower and higher labels. Multiclass output is checked to sum to one within 1e-6, then normalized in float64 to remove float32 roundoff. Invalid native probabilities are typed numerical failures.

Includes the float32 feature-conversion report. Native output buffers and returned probabilities are excluded from that report.

Public estimator packaging with class/probability dispatch, sample-weight routing, package/version provenance, and automatic native serialization attachment. Codec-supported preprocessing persists with the estimator. Loading selects Artifact.classification_codec explicitly; original class order and probability alignment are preserved.