API#

This section provides comprehensive details about the exposed ReLife API. ReLife is structured into different modules, each with a clear and specific role. We divided the API documentation close to the same logic.

ParametricModel

Base class of every parametric models in ReLife.

MaximumLikelihoodOptimizer

Abstract maximum likelihood optimizer.

Lifetime models#

Parametric lifetime models#

Parametric lifetime distributions

Exponential

Exponential lifetime distribution.

Weibull

Weibull lifetime distribution.

Gompertz

Gompertz lifetime distribution.

Gamma

Gamma lifetime distribution.

LogLogistic

Log-logistic probability distribution.

Parametric lifetime regressions

ParametricProportionalHazard

Proportional Hazard regression.

ParametricAcceleratedFailureTime

Accelerated failure time regression.

Semiparametric lifetime regression#

SemiParametricProportionalHazard

Class for Cox, semi-parametric, Proportional Hazards, model

Non parametric lifetime models#

KaplanMeier

Kaplan-Meier estimator.

NelsonAalen

Nelson-Aalen estimator.

ECDF

Empirical Cumulative Distribution Function.

Conditional lifetime models#

Conditional lifetime models

LeftTruncatedModel

Left truncated model.

AgeReplacementModel

Age replacement model.

Stochastic processes#

RenewalProcess

Renewal process.

RenewalRewardProcess

Renewal reward process.

NonHomogeneousPoissonProcess

Non-homogeneous Poisson process.

Maintenance policies#

Convenient functions to instanciate a policy based on the given model and cost structure.

age_replacement_policy

Creates a preventive age replacement policy.

run_to_failure_policy

Creates a run-to-failure policy.

Lower-level policy classes that can be used in addition to the above functions.

AgeReplacementPolicy

Age replacement policy.

OneCycleAgeReplacementPolicy

One-cyle age replacement policy.

RunToFailurePolicy

Run-to-failure renewal policy.

OneCycleRunToFailurePolicy

One cyle run-to-failure policy.

NonHomogeneousPoissonAgeReplacementPolicy

Age replacement policy for non-Homogeneous Poisson process.

Rewards#

RunToFailureReward

Run-to-failure reward.

AgeReplacementReward

Age replacement reward.

ExponentialDiscounting

Exponential discounting.

Built-in datasets#

load_circuit_breaker

Load example dataset of circuit breaker lifetimes.

load_insulator_string

Load example dataset of insulator string lifetimes with covariates.

load_power_transformer

Load example dataset of power transformers lifetimes.

Likelihoods#

Quadratures#

Quadratures are used a many computations. We don’t use Scipy quadrature implementations as, to our knowledge, they don’t support automatic broadcasting of 2D bounds.

legendre_quadrature

Numerical integration of \(f(x)\) over the interval \([a,b]\)

laguerre_quadrature

Numerical integration of \(f(x) * exp(-x)\) over the interval \([a, \infty]\).

unweighted_laguerre_quadrature

Numerical integration of \(f(x)\) over the interval \([a, \infty]\)

Utils#

Various utilities to help with development.

to_numpy_float64

Convert the input to np.float64 if it is a scalar or an array of np.float64 otherwise.

to_column_2d_if_1d

Reshapes to column array.

flatten_if_at_least_2d

Flatten array-like object when possible.

get_nb_assets

Gets the number of assets encoded in args.