Skip to main content

models.ExpectileFit

A fitted expectile regression, from ExpectileRegression.fit.

Usage

Source

models.ExpectileFit()

Attributes

Name Description
covariance The sandwich covariance, a list of rows.
objective The minimised asymmetric squared loss, without the penalty.
standard_errors The sandwich standard errors.

covariance

The sandwich covariance, a list of rows.

covariance: list[list[float]]


objective

The minimised asymmetric squared loss, without the penalty.

objective: float


standard_errors

The sandwich standard errors.

standard_errors: list[float]

Methods

Name Description
from_json() Reads an artifact written by to_json.
predict() The fitted expectile of each row.
predict_distribution() Draws of each row’s fitted expectile under the sandwich covariance.
to_json() The fit as a versioned JSON artifact: the level, the names, the

from_json()

Reads an artifact written by to_json.

Usage

Source

from_json(text)
Parameters
text: str
Returns
ExpectileFit
Raises
ValueError
For malformed JSON, another format, a newer format version or inconsistent fields.

predict()

The fitted expectile of each row.

Usage

Source

predict(design)

predict_distribution()

Draws of each row’s fitted expectile under the sandwich covariance.

Usage

Source

predict_distribution(design, n_sims, seed)
Returns
PredictiveDistribution

to_json()

The fit as a versioned JSON artifact: the level, the names, the

Usage

Source

to_json()

estimates and their covariance, and the fit statistics, numbers bit for bit (#978). from_json reads it back; pickle uses the same document.

Returns
str
Examples
>>> import pickle
>>> from prospicio.models import Design, ExpectileRegression, ExpectileFit
>>> d = Design([[1.0] * 6, [0.0, 1.0, 2.0, 3.0, 4.0, 5.0]], ["(Intercept)", "x"])
>>> fit = ExpectileRegression(0.5).fit(d, [1.0, 2.5, 2.0, 4.0, 5.5, 5.0])
>>> ExpectileFit.from_json(fit.to_json()).coefficients == fit.coefficients

True

>>> pickle.loads(pickle.dumps(fit)).coefficients == fit.coefficients

True