9.2

2 Examples🔗ℹ

Each example below is a literate program: the prose and the code you see are the same source that lives in the package’s "xgboost/examples/" directory and is exercised by the test suite, so the walkthroughs never drift from working code. Every example provides a run-example thunk; its companion harness in "xgboost/examples/test/" drives it and checks the result (run with raco test).

The examples build up in arcs. The core tasks start from the DMatrix container and the high-level train/predict loop. Later arcs — built-in and custom objectives, model IO, DMatrix mechanics, booster inspection, serving-style in-place prediction, parameter recipes and ranking, the process-global APIs, and GPU training — layer on from there.

    2.1 Building a DMatrix

    2.2 Training a regressor

    2.3 Binary classification

    2.4 Multiclass classification

    2.5 Watching an evaluation set

    2.6 Iris: a full classification pipeline

    2.7 Get Started

    2.8 Robust regression

    2.9 Quantile regression

    2.10 Poisson count regression

    2.11 Survival analysis (AFT)

    2.12 Custom objective

    2.13 Saving and loading models

    2.14 Booster snapshots

    2.15 DMatrix constructors

    2.16 DMatrix metadata

    2.17 Slicing and binary serialization

    2.18 Quantile cuts

    2.19 The high-level API end to end

    2.20 Booster lifecycle and config

    2.21 Booster attributes

    2.22 Model dumps and feature importance

    2.23 In-place prediction (dense)

    2.24 In-place prediction (CSR)

    2.25 In-place prediction (columnar)

    2.26 Parameter recipes

    2.27 Learning to rank

    2.28 Global and process APIs

    2.29 CUDA regression

    2.30 CUDA classification