Repository navigation
ENH: Implement cached_value, cached_data proof of concept - #4421
Conversation
|
Some upsides to this approach besides improved thoroughness to
|
d73c39c to
06837d0
Compare
|
maybe for 0.11 (I'm canceling part of appveyor queue) |
|
I’ll ping in a couple months. |
Codecov Report
@@ Coverage Diff @@
## master #4421 +/- ##
==========================================
- Coverage 82.1% 81.55% -0.55%
==========================================
Files 587 569 -18
Lines 93446 89714 -3732
Branches 10372 10037 -335
==========================================
- Hits 76722 73169 -3553
+ Misses 14327 14273 -54
+ Partials 2397 2272 -125
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #4421 +/- ##
==========================================
+ Coverage 82.61% 82.62% +<.01%
==========================================
Files 598 598
Lines 94914 94948 +34
Branches 10463 10472 +9
==========================================
+ Hits 78416 78450 +34
Misses 14079 14079
Partials 2419 2419
Continue to review full report at Codecov.
|
5f1de96 to
8c029a2
Compare
|
De facto green |
| @@ -1,5 +1,7 @@ | |||
| from __future__ import print_function | |||
| from statsmodels.tools.sm_exceptions import CacheWriteWarning | |||
| from statsmodels.compat.pandas import cache_readonly as CR | |||
There was a problem hiding this comment.
I guess it isn't each to import CachedProperty from pandas.
There was a problem hiding this comment.
If you want as as to make it look like a class, then use as CachedProperty
bashtage
left a comment
There was a problem hiding this comment.
It seems like a good idea. Neds follow up to make sure that this works widely.
| @@ -1,5 +1,7 @@ | |||
| from __future__ import print_function | |||
| from statsmodels.tools.sm_exceptions import CacheWriteWarning | |||
| from statsmodels.compat.pandas import cache_readonly as CR | |||
There was a problem hiding this comment.
I guess it isn't each to import CachedProperty from pandas.
| @@ -1,5 +1,7 @@ | |||
| from __future__ import print_function | |||
| from statsmodels.tools.sm_exceptions import CacheWriteWarning | |||
| from statsmodels.compat.pandas import cache_readonly as CR | |||
There was a problem hiding this comment.
If you want as as to make it look like a class, then use as CachedProperty
Yah. If/when this is accepted, I'll follow-up to standardize the usage. |
|
De facto green |
|
@jbrockmendel What is the status of this? Rebase? |
|
Will rebase. This has been ready for a while. If merged, I'll follow up to standardize the usage across the code base. |
The existing approach to
remove_datais haphazard, lets a lot of things fall through the cracks. For the purpose of this Proof Of Concept, the things falling through the cracks areGLMResults.resid_response,resid_deviance,resid_pearson, ... Because these are not listed inGLM.__init__when extendingself._data_attr, they do not get removed whenremove_datais called.On the flip side, there are a number of summary statistics that we would like to retain when pickling but will not if a
cache_readonlyattribute has not been evaluated.The suggestion here is to add two variants of
cache_readonly:cached_valueandcached_data.cached_dataattributes are treated as data-like for the purposes ofremove_data, so will be removed.cached_valueattributes on the other hand will be evaluated before any data is removed, so they can be recovered reliably.Unit tests that would currently fail are included.
The actual implementation of
cached_dataandcached_valueis a stub for demonstration purposes. A real version would need to avoid an import from pandas internals.