boosting.Booster
Gradient-boosted trees for a response family, through LightGBM or
Usage
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,
monotone=None,
interaction_constraints=None
)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.05params: dict = None-
Further engine parameters (
num_leaves,max_depth, …), passed as they are; give constraints throughmonotoneandinteraction_constraintsinstead. monotone: dict = None-
{feature: 1, -1 or 0}: the prediction non-decreasing (1) or non-increasing (-1) in the feature. A feature is a design column’s name or the variable of a monotone term (hinge(x,k),step(x,k),log(x/b)), and the constraint goes on every such column. A factor, a polynomial or spline, a feature in an interaction column and an unknown name are errors. interaction_constraints: list of list of str = None-
Groups of features allowed to interact in a tree; each feature’s columns (factor levels included) enter its groups.
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 |
|---|---|
| engine_params() | The constraint parameters the engine gets for a design with |
| fit() | Fits the booster on design’s columns, offset and weights. |
engine_params()
The constraint parameters the engine gets for a design with
Usage
engine_params(names)columns names: LightGBM monotone_constraints (a list in column order) and interaction_constraints (lists of column indices), or XGBoost’s tuple string and nested list string.
Parameters
names: list of str
Returns
dict
fit()
Fits the booster on design’s columns, offset and weights.
Usage
fit(design, y)Parameters
design: Designy: list of float
Returns
BoosterFit