Skip to content

summary vs. summary2 #1573

Open
Open

Description

@jseabold

We need to come to some decision on this before 0.6.0. Having both is unseemly ;)

Activity

  1. added this to the 0.6 milestone on Apr 8, 2014
  2. josef-pkt commented on Apr 8, 2014

    @josef-pkt
    Member

    not urgent in my opinion.

    I don't want to give up summary (yet), and maybe something like summary2 will still win in the end. Merging them sounds like quite a bit of work, which I don't want to push high on my priorities for 0.6.

    (Coming to a decision other than keeping status-quo might be time consuming.)

  3. vincentarelbundock commented on Apr 8, 2014

    @vincentarelbundock

    I'd love to participate in this debate, but I need to submit my final dissertation draft in a couple weeks...

    Overall, my sense is that the implementation details of summary2 could likely be much improved, but that the conceptual framework is much superior to what is currently in place. In sum, create a summary class that has two types of methods:

    1. add_* (e.g. add_df, add_dict) which takes a variety of input formats and transforms them to data frames. These methods also store a dict of settings which can be set with appropriate keywords for headers, alignments, etc.
    2. as_* (e.g. as_txt, as_latex) which outputs appropriately.

    In principle, this is completely agnostic to the types of inputs allowed or to how those will eventually be combined as outputs. The beauty is that each pieces can be improved on their own.

    Right now there's a dumb function to "align" ascii tables by calculating how many spaces are needed to pad columns. This could be improved, but it works (I think).

    I seem to recall making changes that made the tables look very similar between summary() and summary2(). Customizing the look shouldn't be a problem because they both use SimpleTable.

    If we move away from SimpleTable at some point in the future, summary2() wouldn't need to be changed.

  4. jseabold commented on Apr 8, 2014

    @jseabold
    MemberAuthor

    I assume we have a few months yet to 0.6. Just want to park this here, so we don't lose sight of it.

  5. vincentarelbundock commented on Apr 8, 2014

    @vincentarelbundock

    An intermediate step would be for me to try and replicate the current look of summary() to make sure that's not a sticking point for @josef-pkt , and then to switch around summary() and summary2() for one "important" model (with appropriate tests, of course). That would give us a bit of experience with it.

  6. josef-pkt commented on Apr 8, 2014

    @josef-pkt
    Member

    The problem and work is in the details.
    as_xxx are supposed to work with both summaries, otherwise it's a bug.

    The other problem is in the objective, summary() has a very strict formatting, summary is a lot more flexible, but less "deterministic".

    I think the two could be merged, but it takes time.
    And I'm already behind in reviewing pull request, and I still want to have fun with some of my own things (robust and nonlinear models recently) plus the still required refactoring of robust covariances and post-estimation results across models.

    Right now adding a summary method to a model takes me 5 to <30 minutes.

    (related: adding time stamp when the fit finishes in results.__init__ will remove the main problem for adding unit tests for the summary output.)

  7. josef-pkt commented on Apr 8, 2014

    @josef-pkt
    Member

    OT: non-linear models
    I'm still bailing out on nonlinear LS, lmfit covers the area for now. But I'm slowly working my way backwards through Nonlinear-RLM, nonlinear function in GMM, non-linear MLE and transformation of endog y, log and Box-Cox, or single index models. I'm just more interested in finding the common pattern across models and post-estimation results, than working my way through the NLLS details.

  8. vincentarelbundock commented on Apr 8, 2014

    @vincentarelbundock
    as_xxx are supposed to work with both summaries, otherwise it's a bug.
    

    That's already the case. So no bug here.

    The other problem is in the objective, summary() has a very strict formatting, summary is a lot more flexible, but less "deterministic".
    

    The "flexible" part is true, but not the "deterministic" one. If you want strict formatting, you can simply construct a dataframe with the information you want in it.

    from statsmodels.iolib.summary2 import Summary
    import pandas as pd
    dat = pd.DataFrame([['top-left', 1, 'top-right', 2], ['bottom-left', 3, 'bottom-right', 4]])
    smry = Summary()
    smry.add_df(dat, header=False, index=False)
    print smry.as_text()
    
    ======================================
       top-left 1.0000    top-right 2.0000
    bottom-left 3.0000 bottom-right 4.0000
    ======================================
    
  9. josef-pkt commented on Apr 17, 2014

    @josef-pkt
    Member

    Kerby is using summary2 in mixed models PR.

    One thing that should be improved is right alignment of numbers in the params table

    =====================================================
    Model:               MixedLM  Method:      REML      
    Dependent Variable:  Weight   Res. Var.:   11.3669   
    No. Groups:          72       Likelihood:  -2404.7753
    No. Observations:    861      Converged:   Yes       
    -----------------------------------------------------
              Coef.  Std.Err.    z    P>|z| [0.025 0.975]
    -----------------------------------------------------
    Intercept 15.724 0.788    19.953  0.000 14.179 17.268
    Time      6.943  0.033    207.939 0.000 6.877  7.008 
    RE1       40.393 2.165                               
    =====================================================
    
  10. josef-pkt commented on Apr 17, 2014

    @josef-pkt
    Member

    Thanks, that's better. I didn't check whether it was set specifically in the model

  11. vincentarelbundock commented on Apr 17, 2014

    @vincentarelbundock

    Great. Let me know if there are other style things you'd like to see changed (e.g. spacing between columns.)

  12. josef-pkt commented on Apr 17, 2014

    @josef-pkt
    Member

    Yes, for my taste the top columns are too little separated. Because it doesn't have a block structure (right aligned number/value columns) it's more difficult to quickly check the description and top results
    Model: MixedLM Method: REML

    another one: try a OLS summary where a params is larger than a million. Kevin showed an example like that.

    I would like to switch summary to use two columns for the confidence interval. The current version looks fine in text, but not so good in html.

  13. vincentarelbundock commented on Apr 17, 2014

    @vincentarelbundock

    OK. in summary2 the confidence intervals are already 2 columns. And the ascii printout looks pretty good even with parameters >10**8.

    http://nbviewer.ipython.org/gist/anonymous/11000685

  14. jseabold commented on May 6, 2014

    @jseabold
    MemberAuthor

    It might be helpful to draft a pep on the wiki that lays out the case for change. It does seem like summary2 requires less coding on the model developers part though, which is my big motivation for change.

  15. modified the milestones: 0.6, 0.7 on Aug 16, 2014
  16. modified the milestones: 0.8, 0.7 on Jul 17, 2015
  17. jbrockmendel commented on Sep 2, 2018

    @jbrockmendel
    Contributor

    Agree with OP. This has been “experimental” for ages, and supporting both strains already-strained resources.

  18. vincentarelbundock commented on Sep 7, 2018

    @vincentarelbundock

    Back in the day, I invested a fair amount of time in this, and I remember being fairly convinced that this was a significant improvement.

    I am severely over-committed right now, but will have time in the coming weeks to bring this to completion. I thought I had already addressed most of the issues raised, so all that would be needed would be TODO.

    If there is no viable path forward for summary2 to become default, I agree with @jbrockmendel : his code should be removed.

  19. josef-pkt commented on Sep 7, 2018

    @josef-pkt
    Member

    Actually, having both has worked pretty well.
    There are some problems (like #1964) but overall maintenance went fine. e.g. just merged #5083

    There are several models that only use summary2 because it's more flexible for non-standard cases while simpler standard cases use by default summary.

  20. vincentarelbundock commented on Sep 8, 2018

    @vincentarelbundock

    cool with me. You're the one doing the maintaining after all :)

    Thanks for the quick answer!

  21. josef-pkt commented on Sep 8, 2018

    @josef-pkt
    Member

    You're the one doing the maintaining after all

    more precisely: I'm reviewing and merging maintenance and enhancement PRs in this area which we get every once in a while.

  22. modified the milestones: 0.8, Someday on Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions