Skip to main content

kernels.MLDevelopmentFit

A fitted tree model on one triangle, and each origin’s projection.

Usage

Source

kernels.MLDevelopmentFit(
    spec,
    origin_periods,
    as_of,
    dev_grain_months,
    cumulative,
    trained,
    fitted,
    fitted_cumulative,
    latest,
    latest_dev,
    unity_ages,
    n_training_rows,
    feature_names,
    sklearn_version
)

Arrays are (n_w, n_d) (origins by development ages) unless noted.

Attributes

spec: MLDevelopmentSpec
origin_periods: list of datetime.date

The first day of each origin period.

as_of: datetime.date

The evaluation date of the latest cell.

dev_grain_months: int
cumulative: numpy.ndarray

The cumulative amounts, NaN where unobserved.

trained: numpy.ndarray

Bool: the cells that were training rows.

fitted: numpy.ndarray

The fitted increment in every cell (the difference of the fitted cumulative under response="cumulative"); NaN for every cell of an origin the model cannot place (origin="factor" and no training row), and 0.0 at an age in unity_ages.

fitted_cumulative: numpy.ndarray

The fitted cumulative in every cell; NaN where fitted is.

latest: numpy.ndarray

(n_w,) each origin’s latest cumulative.

latest_dev: numpy.ndarray

(n_w,) the 0-based development index of each origin’s latest cell.

unity_ages: numpy.ndarray

(n_d,) bool: ages with no training row that unsupported_factor="unity" develops by a factor of 1.

n_training_rows: int
feature_names: tuple of str

The design’s columns in order: "intercept", "development:24" (months), "origin:1989-01-01" (the period’s first day), "calendar".

sklearn_version: str
The scikit-learn version that fitted it.

Attributes

Name Description
cdf Each origin’s fitted factor from each age to the last; NaN where the
common_pattern Whether every fitted origin’s factors agree to 1e-12 relative.
factors (n_w, n_d - 1) each origin’s fitted factor from one age to the next;
fitted_latest (n_w,) the fitted cumulative at each origin’s latest age.
fitted_ultimate (n_w,) the fitted cumulative at the last age.
future Bool, the cells past each origin’s latest age.
increments The observed increments (the first age’s is its cumulative), NaN elsewhere.
model_ibnr (n_w,) the sum of each origin’s fitted future increments; NaN for an
origin_cdf (n_w,) each origin’s factor from its latest age to the last.
pattern_cumulative (n_d,) the first fitted origin’s fitted cumulative when every
placed (n_w,) bool: origins the model gives fitted values.
ultimate (n_w,) the latest cumulative times origin_cdf; 0 where the latest is 0.

cdf

Each origin’s fitted factor from each age to the last; NaN where the

cdf: np.ndarray

fitted cumulative is zero or less.


common_pattern

Whether every fitted origin’s factors agree to 1e-12 relative.

common_pattern: bool

True with origin="none" and calendar="none", where every origin gets the same predictions; for a tree model with origin indicators it is almost never true.


factors

(n_w, n_d - 1) each origin’s fitted factor from one age to the next;

factors: np.ndarray

NaN where the fitted cumulative at the earlier age is zero or less.


fitted_latest

(n_w,) the fitted cumulative at each origin’s latest age.

fitted_latest: np.ndarray


fitted_ultimate

(n_w,) the fitted cumulative at the last age.

fitted_ultimate: np.ndarray


future

Bool, the cells past each origin’s latest age.

future: np.ndarray


increments

The observed increments (the first age’s is its cumulative), NaN elsewhere.

increments: np.ndarray


model_ibnr

(n_w,) the sum of each origin’s fitted future increments; NaN for an

model_ibnr: np.ndarray

origin with no fitted values.


origin_cdf

(n_w,) each origin’s factor from its latest age to the last.

origin_cdf: np.ndarray

1.0 for an origin at the last age; NaN where the fitted cumulative at the latest age is zero or less, or the origin has no fitted values.


pattern_cumulative

(n_d,) the first fitted origin’s fitted cumulative when every

pattern_cumulative: np.ndarray | None

origin shares one pattern (common_pattern), else None.


placed

(n_w,) bool: origins the model gives fitted values.

placed: np.ndarray


ultimate

(n_w,) the latest cumulative times origin_cdf; 0 where the latest is 0.

ultimate: np.ndarray