Repository navigation
Conversation
Doctests can be run with:
from statsmodels import nonparametric
nonparametric.test(doctests=True)
Or "nosetests --with-doctest" in the nonparametric dir.
Note that some other doctests seem to be failing at the moment.
CKDE method still to do. Also clean up some docstrings and code.
There was a problem hiding this comment.
Looking at the definition in the docstring and ref [1], the abs calls in the two lines above are incorrect. It's abs(Xi-x), not abs(abs(Xi) - abs(x)). Removing them in my speedup branch.
|
I still don't really like one letter names in the classes. Users can use the formula interface if they don't want to see endog/exog. |
|
Josef, given the number of people being in favor for X/Y (both on-list and in Skippers tutorials) and virtually no one except you liking endog/exog, I really hope you'll reconsider your opinion on this. That issue is orthogonal to this PR though. So I propose to not discuss it further here, and if the status quo is still endog/exog at merge time of this PR, we should use it in this code. |
|
@gpanterov: can you comment on the renaming proposals above? I'd like to get those out of the way, then we're pretty much done with this PR. |
|
Time of |
|
On the naming conventions: |
|
eX, eY is still uninformative, I never managed to guess what the our terminology in general is shorthand names can sometimes be useful inside a function, but for the outside I prefer descriptive names. we don't have |
|
I see a bunch of predict methods, but no parameters with Using |
|
No, we don't have Kernel methods are currently the only ones where we don't just have "parameters", and where we need the full original sample for "prediction". For density estimation there is no real endog and exog, just the data, so I don't really care much. Similar, I usually don't use the endog/exog terminology in statistical tests. |
|
OK, all the renames done in my speedup-nonparametric branch. I included Adding |
|
Ralf, thanks for working through this The way it sounds like, I think we should merge it soon. |
|
Can we indicate somewhere that the CensoredReg, SemiLinear and SingleIndexModel classes are experimental? Or should we exclude them from the PR ? They are a unique feature of statsmodels i.e. they are not present in any other package to my knowledge. But because of this, I was not able to cross-check the output that they give. |
|
I would prefer to merge everything instead of splitting up the pull request again. If there are some tests that they work, then I would just add a comment to the docstrings and leave them in, even if they are not verified against other packages. (I haven't looked at the code for those yet.) |
|
Test coverage should be increased first though if we want to merge everything at once:
I propose to rename George, do you have time to work on those tests in the near future? If not, I propose to leave those things out for now. |
|
What do we do about current |
|
Is there a name clash? Is something called KDE in the PR? If so, I think it should be renamed given that KDE is in use already. If not, I'm ok to change KDE to KDE_1d (or whatever), but we'd have to go through a deprecation period for the current KDE. |
|
The main class is called |
|
I think at least initially we would have to have KDEMultivariate or MultivariateKDE, then we can deprecate KDE and move to this if it's what we really want to do unless there are some plans to separate by namespace (still would be a bit confusing IMO). |
|
Hmm, not sure what would be best. Basically, the current Splitting the two between two namespaces doesn't make sense. |
|
I don't think we want to separate by namespace, too confusing and there are no natural namespaces withing kde. One possibility would be to keep all the KDE with qualifiers. The KDE in this PR is using product kernels, so we could also call it KDEProduct to distinguish from scipy gaussian_kde which I think doesn't impose the product structure. KDEMutivariate is also fine (I'm not sure users care about "Product") (other multivariate: nearest neighbor, rbf kernels ?) |
|
Users indeed won't care much. Multivariate sounds better than Product. |
|
+1 |
|
unless the untested parts will get tests soon, I prefer moving them to the sandbox. And it can be used even if it doesn't have a full test suite, and we can add tests incrementally. (example: We got a bug report for survival2 which is in the sandbox, but the code in the sandbox is outdated and no one has worked on the new version the branch in 7 months. |
|
Ralf can you make a pull request from your branch This branch doesn't contain the extra classes SingleIndexModel, Censored, ... Also I would suggest splitting the module nonparametric2.py into at least two or three parts, density, regression and others? and rename nonparametric2 to "kernel_density.py" or something like that. I only had a brief look at the extras. One of the main parts that might need expansion (later?) is to check what should be returned by fit, there are currently no results classes. |
|
Yes, will get the last renames done and send a PR this week. @gpanterov I'll follow Josef's suggestion on moving things that aren't tested to the sandbox; they can always be moved back as soon as we have tests. |
|
Please go ahead and move them to the sandbox Ralf. I was thinking along the same lines. I will have time to write some tests for them in the next few weeks. But I can't do it immediately ... |
|
New PR opened, so closing this one. |
Nonparametric Density estimators. Conditional and Unconditional multivariable mixed data estimation available with plug-in (normal-reference) and data-driven bandwidth selection methods (cross-validation least squares and cross-validation maximum likelihood).