Skip to content

ENH: Add stopping criteria and history to GLSAR - #2269

Closed
bashtage wants to merge 1 commit into
statsmodels:masterfrom
bashtage:glsar-convergence-history
Closed

bashtage wants to merge 1 commit into
statsmodels:masterfrom
bashtage:glsar-convergence-history

Conversation

@bashtage

Copy link
Copy Markdown
Member

Added relative criteria stopping criteria to GLSAR. Also added
history to fit results.

closes #181

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0%) to 83.94% when pulling 55e10ee on bashtage:glsar-convergence-history into b3e978a on statsmodels:master.

@josef-pkt

Copy link
Copy Markdown
Member

FYI: I think I will leave most or all changes to existing code that are not pure or high priority bug-fixes for 0.8, merging after 0.7 is tagged.

Thanks for working on these issues. I'll add some inline comments

Comment thread statsmodels/regression/linear_model.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should not store a results instance, since it will be stale right away (point to the wrong model attributes), and might use up memory.
As in GLM and RLM we should store a few attributes that we might use for convergence criteria or as fit information. History is a dict in both models
GEE has a _fit_history which is also a dict.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a bug - should be just params

@bashtage
bashtage force-pushed the glsar-convergence-history branch from 55e10ee to 49f64f0 Compare February 16, 2015 01:09
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0%) to 83.94% when pulling 49f64f0 on bashtage:glsar-convergence-history into b3e978a on statsmodels:master.

Comment thread statsmodels/regression/linear_model.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not stop early if some params become very small, being close to zero.
I think adding also atol and using np.allclose with both would be better.

@josef-pkt

Copy link
Copy Markdown
Member

To make this a bit more future proof you could change the history to a dict history['params'].
Then we can add other convergence criteria, and we can add history['rho']
rho would be another candidate for a convergence check

@josef-pkt

Copy link
Copy Markdown
Member

@bashtage If you change the history to a dict, then I can merge it for 0.7, that's the only place I want to avoid future changes.

@bashtage
bashtage force-pushed the glsar-convergence-history branch from 49f64f0 to b972a55 Compare February 17, 2015 03:10
@bashtage
bashtage force-pushed the glsar-convergence-history branch from b972a55 to 60cb04b Compare June 19, 2015 22:49
@josef-pkt josef-pkt modified the milestones: 0.8, 0.7 Jun 23, 2015
Added relative criteria stopping criteria to GLSAR. Also added
history to fit results.

closes statsmodels#181
@bashtage
bashtage force-pushed the glsar-convergence-history branch from 60cb04b to 497a16a Compare July 10, 2015 21:21
@josef-pkt

Copy link
Copy Markdown
Member

I didn't realize that this has been changed. I started to look at it and try it out.
I have some changes, but I think it will still be ready for merging soon (0.7)

@josef-pkt josef-pkt modified the milestones: 0.7, 0.8 Jul 15, 2015
@josef-pkt josef-pkt mentioned this pull request Jul 15, 2015

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bashtage Was there a specific reason to converting the list, besides having a nicer print?
I'm planning on removing this for 0.7, because it make indexing difficult because of inconsistent behavior between pandas, numpy, and python lists.

A possible alternative would be to use a simple history subclass of python list that has a as_dataframe attribute, which could also add rho and maybe other things to the history DataFrame. But this would have to be introduced consistently for all histories in models with specialized iterative solvers.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, just making it more user friendly if it was every going ot be used by an end user.

@josef-pkt josef-pkt closed this in f273215 Jul 24, 2015
@bashtage
bashtage deleted the glsar-convergence-history branch February 16, 2016 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GLSAR add history and convergence criteria

3 participants