6c3543844a0ba1e05892d4bb37bf3035c9561cd9,lifelines/fitters/generalized_gamma_fitter.py,GeneralizedGammaFitter,_log_hazard,#GeneralizedGammaFitter#Any#Any#,147

Before Change


                - ln_sigma_
                - gammaln(ilambda_2)
                + (lambda_ * Z - safe_exp(lambda_ * Z) - 2 * log(lambda_)) * ilambda_2
                - gammainccln(ilambda_2, safe_exp(lambda_ * Z - 2 * np.log(lambda_)))
            )
        else:
            v = (
                log(-lambda_)
                - log(times)
                - ln_sigma_
                - gammaln(ilambda_2)
                + (lambda_ * Z - safe_exp(lambda_ * Z) - 2 * log(-lambda_)) * ilambda_2
                - gammaincln(ilambda_2, safe_exp(lambda_ * Z - 2 * np.log(-lambda_)))
            )
        return v

After Change


    def _log_hazard(self, params, times):
        mu_, ln_sigma_, lambda_ = params
        ilambda_2 = 1 / lambda_ ** 2
        Z = (log(times) - mu_) / safe_exp(ln_sigma_)
        clipped_exp = np.clip(safe_exp(lambda_ * Z) * ilambda_2, 1e-10, 1e20)
        if lambda_ > 0:
            v = (
                log(lambda_)
                - log(times)
                - ln_sigma_
                - gammaln(ilambda_2)
                + (lambda_ * Z - safe_exp(lambda_ * Z) - 2 * log(lambda_)) * ilambda_2
                - gammainccln(ilambda_2, clipped_exp)
            )
        elif lambda_ < 0:
            v = (
                log(-lambda_)
                - log(times)
                - ln_sigma_
                - gammaln(ilambda_2)
                + (lambda_ * Z - safe_exp(lambda_ * Z) - 2 * log(-lambda_)) * ilambda_2
                - gammaincln(ilambda_2, clipped_exp)
            )
        else:
            v = norm.logpdf(Z, loc=0, scale=1) - ln_sigma_ - log(times) - norm.logsf(Z)
        return v

    def percentile(self, p):
        lambda_ = self.lambda_
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 21

Instances


Project Name: CamDavidsonPilon/lifelines
Commit Name: 6c3543844a0ba1e05892d4bb37bf3035c9561cd9
Time: 2020-02-20
Author: cam.davidson.pilon@gmail.com
File Name: lifelines/fitters/generalized_gamma_fitter.py
Class Name: GeneralizedGammaFitter
Method Name: _log_hazard


Project Name: CamDavidsonPilon/lifelines
Commit Name: 6c3543844a0ba1e05892d4bb37bf3035c9561cd9
Time: 2020-02-20
Author: cam.davidson.pilon@gmail.com
File Name: lifelines/fitters/generalized_gamma_fitter.py
Class Name: GeneralizedGammaFitter
Method Name: _cumulative_hazard


Project Name: CamDavidsonPilon/lifelines
Commit Name: 6c3543844a0ba1e05892d4bb37bf3035c9561cd9
Time: 2020-02-20
Author: cam.davidson.pilon@gmail.com
File Name: lifelines/fitters/generalized_gamma_fitter.py
Class Name: GeneralizedGammaFitter
Method Name: _log_1m_sf


Project Name: CamDavidsonPilon/lifelines
Commit Name: 6c3543844a0ba1e05892d4bb37bf3035c9561cd9
Time: 2020-02-20
Author: cam.davidson.pilon@gmail.com
File Name: lifelines/fitters/generalized_gamma_fitter.py
Class Name: GeneralizedGammaFitter
Method Name: _log_hazard