You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
REF: review and refactor for computational efficiency in ZeroInflated models #7632
The zeroinflated models have not been reviewed for computational efficiency in loglike and similar.
(My review before merging was mainly functional.)
hessian uses double loop (but for triangle, and so might not necessarily be slower than the rectangular vectorized solution)
no, or not enough temp variables, e.g. indexing occurs multiple times within methods, e.g. self.exog_infl[zero_idx, i], np.exp(llf[zero_idx]))
zero_idx could be attached as attribute instead of computed each time
score_obs uses numerical derivatives for probit inflation, this should be possible to be computed generically with delegating the binary model specific part to the inflation model.
also the computations are difficult to read, no visible structure (by algebraic priority rules)
derivative w.r.t. zero model params dldw can use score_obs, score_factor from inflation model. currently logit is explicit and probit uses numdiff
use of score_obs of submodels can be replace by score_factor to the score_factor of ZI model
hessian
uses currently numdiff because _hessian_main returns None
The code in hessian that is currently not used does not look correct to me. Maybe it is, _hessian_logit contains the cross model derivative. (explicit formulas are or will be complicated)
Note,
score_factor if k_extra>0, with GPP, NBP as main model, will have 3 terms, one score factor for inflation model, two score factors for main model (mean parameters and extra shape/dispersion parameter)
NB can have either zero or one k_extra, but it does not have score_factor yet. (k_extra=0 for geometric special case)
Activity
josef-pkt commentedon May 5, 2023
we need also score_factor for
score_testreview score hessian
dldwcan use score_obs, score_factor from inflation model. currently logit is explicit and probit uses numdiffscore_factorof ZI model_hessian_mainreturns None_hessian_logitcontains the cross model derivative. (explicit formulas are or will be complicated)Note,
score_factor if k_extra>0, with GPP, NBP as main model, will have 3 terms, one score factor for inflation model, two score factors for main model (mean parameters and extra shape/dispersion parameter)
NB can have either zero or one k_extra, but it does not have score_factor yet. (k_extra=0 for geometric special case)