Skip to main content

kernels.MLDevelopmentSpec

What to fit: the estimator, its settings, the response and the design.

Usage

Source

kernels.MLDevelopmentSpec(
    estimator,
    seed=0,
    n_estimators=100,
    max_depth=None,
    min_samples_leaf=None,
    learning_rate=None,
    response="incremental",
    origin="factor",
    calendar="none",
    zero_cells="observed",
    unsupported_factor="raise"
)

Attributes

estimator: str

"random_forest" (scikit-learn’s RandomForestRegressor) or "gradient_boosting" (GradientBoostingRegressor). No default: the two answers are far apart (52% on one Schedule P triangle).

seed: int

Passed to scikit-learn as random_state, unchanged: a whole number from 0 to SEED_MAX. None is refused, because a forest with no seed gives a different answer on every call.

n_estimators: int

Trees in the forest, or boosting stages (100).

max_depth: int or None

The deepest a tree may grow; None is unlimited for the forest and 3 for boosting, scikit-learn’s defaults.

min_samples_leaf: int or None

The forest only: the fewest rows in a leaf; None is 1. Refused with gradient_boosting, where it would change nothing here.

learning_rate: float or None

Boosting only: the shrinkage of each stage, above 0; None is 0.1. Refused with random_forest, which has no such setting.

response: str

"incremental" (the default) models each cell’s increment; "cumulative" models its cumulative.

origin: str

"factor" (the default): an indicator per origin. "none": no origin term, so every origin shares one fitted pattern.

calendar: str

"none" (the default) or "trend": the calendar period, counted in development steps from the first origin’s first cell, as one numeric column (chainladder-python’s valuation).

zero_cells: str

"observed" (the default) trains on every observed cell, a zero cumulative included. "missing" leaves out every cell whose cumulative is zero, as chainladder-python does.

unsupported_factor: str
Under zero_cells="missing", what to do at a development age whose cells are all zero, which leaves the model nothing to fit there: "raise" (the default) refuses; "unity" develops by a factor of 1 into that age (a fitted increment of 0).

Attributes

Name Description
settings The estimator’s settings as scikit-learn gets them, None filled in.

settings

The estimator’s settings as scikit-learn gets them, None filled in.

settings: dict

max_depth stays None for an unlimited forest; min_samples_leaf is None for boosting and learning_rate for the forest.