rte-france / relife

ReLife is an open source Python library for asset management based on reliability theory and lifetime data analysis.
Apache License 2.0
17 stars 2 forks source link

Issue with convergence of ParametricLifetimeDistribution.fit() #5

Open figolus opened 2 years ago

figolus commented 2 years ago

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).