Skip to content

ENH: add penalized classes, cases for penalized mixin #7128

Open

Description

@josef-pkt

I think our PenalizedMixin is underused and not very convenient.

We need specific classes to make it more usable, and so we can start to collect more post-estimation results.
e.g. adding penalization specific information criteria #5404

We might also want to add some with a specific penalty function, e.g. GLMSCAD or similar, e.g. for use with sure independence screening SIS.

extension
Two part models like zero-inflated, or later models that have mean and variance functions are not yet (fully) supported for variable selection, e.g. SIS, variable addition score_test. Although, PenalizedMixin should be generic enough for those.

related: missing features in GAM #8029

Activity

  1. josef-pkt commented on Oct 30, 2020

    @josef-pkt
    MemberAuthor

    example beta regression with two exog
    Zhao, Weihua, Riquan Zhang, Yazhao Lv, and Jicai Liu. 2014. “Variable Selection for Varying Dispersion Beta Regression Model.” Journal of Applied Statistics 41 (1): 95–108. https://doi.org/10.1080/02664763.2013.830284.

  2. josef-pkt commented on Oct 31, 2020

    @josef-pkt
    MemberAuthor

    ZIP-SCAD
    Buu, Anne, Norman J. Johnson, Runze Li, and Xianming Tan. 2011. “New Variable Selection Methods for Zero-Inflated Count Data with Applications to the Substance Abuse Field.” Statistics in Medicine 30 (18): 2326–40. https://doi.org/10.1002/sim.4268.

    they use a one-step quadratic approximation to penalized loglike
    penalization parameter selected by modified BIC (no formula for it but reference, mayby TIC-version on selected model)
    They use penalization weights proportional to full MLE bse to reduce to one tuning parameter
    They report binary fit measures, specificity, sensitivity, ... for variable selection in simulations.

    aside: references include score tests for zero-inflation
    29. van den Broek J. A score test for zero inflation in a Poisson distribution. Biometrics 1995; 51:738--743.
    31. Deng D, Paul SR. Score tests for zero-inflation and over-dispersion in generalized linear models. Statistica Sinica
    2005; 15:257--276.

    I used the first for diagnostics_count, but don't seem to have downloaded the second article

  3. added this to the 0.14 milestone on Nov 28, 2021
  4. josef-pkt commented on Nov 28, 2021

    @josef-pkt
    MemberAuthor

    bump.
    I would like to try this with BetaModel. see reference above for SCAD penalization
    I guess nothing in the PenalizedMixin assumes that we only have one exog, so penalized BetaModel should work generically.

  5. josef-pkt commented on Nov 28, 2021

    @josef-pkt
    MemberAuthor

    oops, last two comment should be in a PR, will copy there and delete here

  6. modified the milestones: 0.14, 0.15 on Dec 14, 2022
  7. josef-pkt commented on Mar 3, 2023

    @josef-pkt
    MemberAuthor

    Current unit tests (in base/tests) use only one-parameter models. GLM, Poisson, Logit, Probit, Gaussian

    There could still be problems with multi-parameter models, e.g. how null model is defined.
    example would be OrderedModel, besides, multi-parameter count models like NBP, GPP
    https://stackoverflow.com/questions/75624091/ordinal-logistic-regression-with-regularization

    update
    quick try. It works, but bfgs has convergence problems (precision loss) for some pen_weights

    example from
    https://stackoverflow.com/questions/75559325/llr-pvalue-extract-from-orderedresults-statsmodels

    penalty = smpen.SCADSmoothed(0.1, c0=0.001)
    mod = OrderedPenalized(data_student['apply'],
                           data_student[['pared', 'public', 'gpa', 'rand']],
                           distr='probit', 
                           penal=penalty)
    pw = np.array([1, 1, 1, 1, 0, 0])
    mod.pen_weight *= 1e-1
    mod.penal.weights = pw
    mod.penal.tau = 0.05
    res1 = mod.fit(method='lbfgs', maxiter=100, disp=1)
    print(res1.summary())
    

    aside: ordered model summary does not show llnull, llr_pvalue and prsquared. Those are available as results attributes

  8. josef-pkt commented on Mar 4, 2023

    @josef-pkt
    MemberAuthor

    semi-random thought looking at the OrderedPenalized results
    scaling of exog and params in penalties, e.g. exog are not zscored
    penalities like SCAD are not scale independent, AFAIR

    not sure if I seen this already or added comments somewhere

    quick try using weights,
    thresholds/constants are not penalized.
    coefficients for exog are penalized proportional to their exog.std

    pw = np.concatenate((mod.exog.std(0), [0, 0]))
    mod.penal.weights = pw
    
  9. josef-pkt commented on Mar 4, 2023

    @josef-pkt
    MemberAuthor

    penalized mixin model results has standard aic, bic

    in gam results class __init__ we have

            edf = self.edf.sum()
            self.df_model = edf - 1  # assume constant
            # need to use nobs or wnobs attribute
            self.df_resid = self.model.endog.shape[0] - edf
    

    and info criteria are defined in GLMResults using df_model

    also: Bug compared to docstring
    PenalizedMixin.fit uses hardcoded trim threshold, instead of keyword value if provided

  10. YogiOnBioinformatics commented on Oct 8, 2024

    @YogiOnBioinformatics

    @josef-pkt are there any plans to create the regularized Ordinal Regression?

  11. josef-pkt commented on Oct 9, 2024

    @josef-pkt
    MemberAuthor

    I never thought about penalized ordinal regression and have not read any references about it.

    However, the Mixin class applies to all maximum likelihood models that use generic (scipy) optimizers in fit.
    AFAIR, parameters, like the threshold parameters, can be exempt from penalization using the weights keyword in the Mixin or by specifying an appropriate penalty function (e.g. stochastic constraint matrix in L2 penalization).

  12. YogiOnBioinformatics commented on Oct 16, 2024

    @YogiOnBioinformatics

    @josef-pkt

    This is an example of penalized Ordinal Regression that's the most famous.
    https://cloud.r-project.org/web/packages/ordinalNet/ordinalNet.pdf

    I guess I'm just looking to see if this type of functionality can also be applied here.

    I'm not too sure what you mean by the last sentence (sorry for that).
    Do you mind rephrasing or providing an example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions