rte-france / relife Goto Github PK
View Code? Open in Web Editor NEWReLife is an open source Python library for asset management based on reliability theory and lifetime data analysis.
License: Apache License 2.0
ReLife is an open source Python library for asset management based on reliability theory and lifetime data analysis.
License: Apache License 2.0
Should allow to customized label names when plotting ECDF:
# Import load_circuit_breaker function from relife.dataset
from relife import *
from relife.datasets import load_circuit_breaker
# Assign time, event variables from dataset
time, event = load_circuit_breaker().astuple()[:-1]
# Get only time values for observed event
time1 = time[event==1]
# Fit ECDF estimator to time1
ecdf = ECDF().fit(time1)
# Plot ECDF estimator of F and 1-F
ecdf.plot(label='custom_label')
returns error:
TypeError: plot() got multiple values for keyword argument 'label'
The computation of the derivative of the upper gamma function in
def _jac_uppergamma_c(c: np.ndarray, x: np.ndarray) -> np.ndarray:
return shifted_laguerre(lambda s: np.log(s) * s ** (c - 1), x, ndim=np.ndim(x))
is unstable for low values of the parameters. The numerical result diverges from the true value as parameters go to 0. Test example : c = 0.001, x = 0.002.
returns an error printing variance for a Gamma distribution.
test:
from relife import *
gamma = Gamma(c = 41.26, rate = 1.62)
gamma.var()
returns:
TypeError: var() missing 1 required positional argument: 'params'
should returns the variance of the gamma distribution as a float.
temporary solution:
gamma.var(gamma.params)
A proposition to fix this issue:
In distribution.py:
def var(self) -> np.ndarray:
c, rate = self.params
return c / (rate**2)
"Fit the empirical cumuative distribution function."
instead of:
"Fit the empirical cumulative distribution function."
Some issues may happen when fitting data. There is a convergence problem using with the minimize function of scipy.
Here is an example with Gompertz distribution:
from relife import *
weibull = Weibull(c=7.531, rate=0.037)
rtf = RunToFailure(weibull, cf=1)
datagen = rtf.sample(T=300, n_samples=100, random_state=0)
time, event, entry = datagen.to_lifetime_data(t0=0,tf=30).astuple()
gompertz = Gompertz().fit(time,event,entry)
/home/xxx/.local/lib/python3.8/site-packages/relife/parametric.py:347: RuntimeWarning: invalid value encountered in sqrt
self.se = np.sqrt(np.diag(self.var))
Problem may be solved by improving the initialization "params0" and/or using another type of solver (by default L-BFGS).
When plotting a ParametricLifetimeDistribution, the plot label is by default the name of the distribution.
Would be better to add the name of the function (=fname) by default (ex: "Exponential sf", instead of "Exponential").
is : f(t) = c \lambda^c t^{c-1} e^{-(\lambda t)^c}
should be : f(t) = c \lambda (\lambda t)^{c-1} e^{-(\lambda t)^c}
(right formula for a parametrization with rate parameter \lambda).
for ar in OneCycleAgeReplacementPolicy and ar1 for AgeReplacementPolicy:
should be "times to preventive replacements" or "times until preventive replacements" (or sthg else) instead of "Ages of the first preventive replacements"
Hello,
I am fitting a Kaplan-Meier estimator with doubly censored data. But I get an error. To reproduce the error use the example below.
from relife.nonparametric import KaplanMeier as KM
km = KM()
km.fit(time=np.array([1,2,3]),event=np.array([1,0,2]))
The error is:
File ~/relife/nonparametric.py:54 in _estimate
raise ValueError("event values must be in [0,1]")
ValueError: event values must be in [0,1]
But the documentation says that event 2 is used to flag an event as left-censored.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.