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
BUG: undefined name in grouputils.dummy_sparse #5687
def dummy_sparse(groups):
from scipy import sparse
indptr = np.arange(len(groups)+1)
data = np.ones(len(groups), dtype=np.int8)
indi = sparse.csr_matrix((data, g, indptr))
return indi
But the g variable is undefined. I'm pretty sure that should be groups instead of g. @josef-pkt can you confirm this guess? If so, would the example in the docstring make for a valid test case if I push a PR fixing this?
This might be obsolete. AFAIR, I had an updated version somewhere in a PR or merged. I'm not sure where. A file search in master does not find any other version.
(maybe in sparse ols or absorb PRs)
I'm also pretty sure g should be replaced by groups. examples in docstring looks fine as test case
There is no newer version of the function in master, AFAICS, so the function is not obsolete and should be fixed.
Whether we add more specific sparse matrix support and where those function will finally end up is a question for future PRs, or future resurrection of old PRs.
It looks like there is a dummy_sparse method in Grouping that is tested. I'd guess that this was intended to replace the dummy_sparse function, except for the fact that the function is still called in one place from within Group.dummy.
Is it possible that the call to the function in Group.dummy is supposed to be updated to call the (apparently better-maintained) method?
No, a method in a class is not a substitute for the standalone function.
Aside: the module reflects the conflict between maintainers at the time.
There is one version based on numpy and one version based on pandas.
(It's a bit like summary versus summary2)
Or for that matter, since the method and the function do use very similar code, the function could be fixed and the method could dispatch to the function.
the function could be fixed and the method could dispatch to the function.
that's better. Grouping is a detour and designed to use pandas, which I don't want when I have computational code as in my absorb PR (Actually, there I do have a group-demean version that uses pandas because it is more flexible and faster than my numpy version for that case.)
Activity
josef-pkt commentedon May 10, 2019
This might be obsolete. AFAIR, I had an updated version somewhere in a PR or merged. I'm not sure where. A file search in master does not find any other version.
(maybe in sparse ols or absorb PRs)
I'm also pretty sure g should be replaced by groups. examples in docstring looks fine as test case
josef-pkt commentedon May 10, 2019
original issue #2771
josef-pkt commentedon May 10, 2019
https://github.com/statsmodels/statsmodels/pull/2774/files#diff-e459740527a87bb33465739def4becffR48
uses
groupsjbrockmendel commentedon May 11, 2019
Do you mean the entire function?
josef-pkt commentedon May 11, 2019
There is no newer version of the function in master, AFAICS, so the function is not obsolete and should be fixed.
Whether we add more specific sparse matrix support and where those function will finally end up is a question for future PRs, or future resurrection of old PRs.
jbrockmendel commentedon May 14, 2019
It looks like there is a
dummy_sparsemethod inGroupingthat is tested. I'd guess that this was intended to replace the dummy_sparse function, except for the fact that the function is still called in one place from withinGroup.dummy.Is it possible that the call to the function in Group.dummy is supposed to be updated to call the (apparently better-maintained) method?
josef-pkt commentedon May 14, 2019
No, a method in a class is not a substitute for the standalone function.
Aside: the module reflects the conflict between maintainers at the time.
There is one version based on numpy and one version based on pandas.
(It's a bit like summary versus summary2)
Neither version strictly dominates the other.
jbrockmendel commentedon May 14, 2019
The idea would not be to remove the function altogether, but to have it defer its implementation, e.g.:
Or for that matter, since the method and the function do use very similar code, the function could be fixed and the method could dispatch to the function.
BUG: fix+test NameError in grouputils, closes statsmodels#5687
BUG: fix+test NameError in grouputils, closes statsmodels#5687
josef-pkt commentedon May 14, 2019
that's better. Grouping is a detour and designed to use pandas, which I don't want when I have computational code as in my absorb PR (Actually, there I do have a group-demean version that uses pandas because it is more flexible and faster than my numpy version for that case.)
BUG: fix+test NameError in grouputils, closes statsmodels#5687
BUG: fix+test NameError in grouputils, closes statsmodels#5687
BUG: fix+test NameError in grouputils, closes statsmodels#5687