boosting.Booster

Gradient-boosted trees for a response family, through LightGBM or

Usage

Source

boosting.Booster(
    family="poisson",
    engine="lightgbm",
    power=None,
    n_rounds=200,
    learning_rate=0.05,
    params=None,
    n_boot=0,
    seed=0,
    alpha=None,
    dispersion_model=False
)

XGBoost.

Parameters

family: (poisson, gamma, tweedie, gaussian, quantile) = "poisson"

The engine’s objective; a log link for the first three. "quantile" fits the alpha quantile of the response (no link, no offset).

engine: (lightgbm, xgboost) = "lightgbm"
power: float = None

Tweedie variance power in (1, 2); required for "tweedie".

alpha: float = None

Quantile level in (0, 1); required for "quantile".

dispersion_model: bool = False

Fit a dispersion per row (gamma, Tweedie and Gaussian families).

n_rounds: int = 200

Boosting rounds.

learning_rate: float = 0.05
params: dict = None

Further engine parameters (num_leaves, max_depth, monotone_constraints, …), passed as they are.

n_boot: int = 0

Bootstrap refits for parameter uncertainty in predict_distribution; 0 gives process noise only.

seed: int = 0
Seeds the engine and the bootstrap resamples.

Examples

>>> from prospicio.boosting import Booster
>>> from prospicio.models import Design
>>> x = [i % 10 / 10 for i in range(200)]
>>> d = Design([x], ["x"], offset=[0.0] * 200)
>>> y = [float(i % 3 == 0) + v for i, v in enumerate(x)]
>>> fit = Booster("poisson", n_rounds=20).fit(d, y)
>>> len(fit.predict(d))

200

Methods

Name Description
fit() Fits the booster on design’s columns, offset and weights.

fit()

Fits the booster on design’s columns, offset and weights.

Usage

Source

fit(design, y)
Parameters
design: Design
y: list of float
Returns
BoosterFit