Skip to content

Nonparametric kernel density estimation and regression. - #562

Closed
rgommers wants to merge 41 commits into
statsmodels:masterfrom
rgommers:nonparametric
Closed

rgommers wants to merge 41 commits into
statsmodels:masterfrom
rgommers:nonparametric

Conversation

@rgommers

@rgommers rgommers commented Nov 3, 2012

Copy link
Copy Markdown
Member

See #408 for history. Now renamed KDE and ConditionalKDE to KDEMultivariate and KDEMultivariateConditional respectively. Untested parts moved to sandbox.

Still TODO:

  • some test failures, mainly precision issues.
  • rename Reg?
  • is run time of tests acceptable?
  • test coverage is about 75%, could be better.
  • does kernels.py need to be renamed? There's also a kernels.py in sandbox, used for the existing KDE.
  • clean up nonparametric module some more? Current names for KDE, bandwidths are too generic.
  • add more docs, especially a good module docstring listing and comparing all functionality.

gpanterov and others added 30 commits October 12, 2012 21:59
Supports continuous, ordered and unordered data (can be mixed).
…to nonparametric.

Note: Not yet completely finished, nor does it have tests.
…ule.

Note: not yet completely finished, nor does it have tests.
Replaced with : and np.column_stack for clarity.  Address review comments from
Josef on PR-408.
Addresses one of Josef's comments on PR-408.
gpke() should only accept ndarrays instead of array_like, same for kernels.
They get called so often that it doesn't make sense to call asarray in them.
On a simple test asarray got called 1e5 times for one bw estimation.

Speedup of this commit ~35% on bw estimation in KDE with cv_ls for the dataset
in the tests.
Remove vectorization over number of variables K.
This is ineffective, because N >> K, and requires way too many asarray
and reshape calls.
Some test failures left, mostly due to too high test precision it seems.
Speeds up running nonparametric.test() by ~15%.
…aster.

The bandwidth gets calculated over and over in the tests, this isn't necessary
for tests that focus on pdf/cdf/mfx/...  So simply provide the bandwidth.
N --> nobs
tdat --> data
txdat --> exog
tydat --> endog
all_vars --> data
K_dep --> k_dep
K_indep --> k_indep
G_y --> cdf_endog
edat --> data_predict
exdat --> exog_predict
eydat --> endog_predict
ezdat --> exog_nonparametric-predict
tzdat --> exog_nonparametric
W_x --> cdf_exog
@josef-pkt

Copy link
Copy Markdown
Member

can I merge this?

We can address specific issues based on master with new pull requests.

I'd like to work a few days on this without worrying too much about merge conflicts.
my current changes
josef-pkt/statsmodels@b89c23a...rgommers_nonparametric_rebased

mostly examples, and I just started to check the sphinx documentation build

@jseabold

jseabold commented Jan 6, 2013

Copy link
Copy Markdown
Member

Fine by me to merge. Can address issues as they come up. I won't have time to devote to this for the short term future.

On Jan 6, 2013, at 5:31 PM, Josef Perktold [email protected] wrote:

can I merge this?

We can address specific issues based on master with new pull requests.

I'd like to work a few days on this without worrying too much about merge conflicts.
my current changes
josef-pkt/statsmodels@b89c23a...rgommers_nonparametric_rebased

mostly examples, and I just started to check the sphinx documentation build

—
Reply to this email directly or view it on GitHub.

@josef-pkt

Copy link
Copy Markdown
Member

new rename ? KernelCensoredReg -> CensoredKernelReg
whenever I tried to write the name, I have to check because I always want to write it the other way.

@josef-pkt

Copy link
Copy Markdown
Member

another rename SemiLinear -> SemiLinearModel

KernelRegressionModel would be more explicit but a bit long, maybe

@josef-pkt

Copy link
Copy Markdown
Member

rename self.est self.func and usage of func to something more descriptive in regression classes

fit_func, objective_func, fit_method, ... ?

@gpanterov

Copy link
Copy Markdown
Contributor

I think fit_method is more accurate

@rgommers

rgommers commented Jan 7, 2013

Copy link
Copy Markdown
Member Author

If it helps you to merge now, that's fine with me. There's still a good number of review comments that you made over the past week to address. I'm planning to do that in the next few days.

@josef-pkt

Copy link
Copy Markdown
Member

My main worry is that if we don't merge, then either I cannot edit much, or we end up with many merge conflicts.
My guess is that I will still have more comments as long as I keep looking at this.

@josef-pkt

Copy link
Copy Markdown
Member

Also, I'd like to separate a bit naming/style/structure questions from "correctness"/correct usage questions.

For example, looking at SingleIndexModel: Why is there more than one bandwidth parameter? Should be only 1 not K in my reading. (I don't have a full example yet to check this.)

@jseabold

jseabold commented Jan 7, 2013

Copy link
Copy Markdown
Member

I think there's something to be said for merging quicker and then iterating
as we release (also quicker). That way you can think of end users as
reviewers too - and the review process now takes a few review cycles as the
project matures. That said, we don't want to be locked into anything that
completely doesn't look right from an interface standpoint.

On Mon, Jan 7, 2013 at 1:03 PM, Josef Perktold [email protected]:

Also, I'd like to separate a bit naming/style/structure questions from
"correctness"/correct usage questions.

For example, looking at SingleIndexModel: Why is there more than one
bandwidth parameter? Should be only 1 not K in my reading. (I don't have a
full example yet to check this.)

—
Reply to this email directly or view it on GitHubhttps://github.com//pull/562#issuecomment-11962783.

@rgommers

rgommers commented Jan 7, 2013

Copy link
Copy Markdown
Member Author

@josef-pkt in that case I think it's fine to keep opening new issues. I see you're labeling them with comp-nonparametric, so they're easy to find.

I have no problem rebasing and resolving conflicts, so let's merge this now and then we'll both open new PRs as needed.

@rgommers

rgommers commented Jan 7, 2013

Copy link
Copy Markdown
Member Author

re: SingleIndexModel, I've cleaned up the parts in kernel_extras.py a little, but haven't looked at them in much detail. So I don't have much of an idea about the 1 vs. K bandwidths right now.

Constructing new examples like you're doing is a good approach to quickly find what doesn't work.

@josef-pkt

Copy link
Copy Markdown
Member

(My old wish: developers write ready-to-run examples)

I think I got the main problems resolved in SingleIndexModel.

I will look into merging tonight, I need to check my SingleIndex example and then it's family time.

@jseabold I agree in general, but in the current state, this PR is not really ready and will still need some work. However, I prefer to do that after a first merge.

@josef-pkt

Copy link
Copy Markdown
Member

I was checking this branch for the merge

I'm surprised that the changes by George start in October. Did you do a history rewrite or is it because of a cherry-pick merge?

@rgommers

rgommers commented Jan 8, 2013

Copy link
Copy Markdown
Member Author

Yes, the history was too much of a mess to be able to rebase, so I took George's final branch and recommitted it after dividing it into logical chunks of code.

josef-pkt added a commit that referenced this pull request Jan 10, 2013
nonparametric examples and some fixes, followup to PR #562
@coveralls

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 5969ef0 on rgommers:nonparametric into * on statsmodels:master*.

@josef-pkt

Copy link
Copy Markdown
Member

That's the second screwed up comment by coveralls.
From the coverage report it got the wrong repo, it's all ruby.

@jseabold

Copy link
Copy Markdown
Member

I sent them a tweet. It's not anything in our config is it? I haven't touched this stuff.

@josef-pkt

Copy link
Copy Markdown
Member

We haven't changed our config in a long time.
The only covaralls issues I can find are private/"pro" related.

@jseabold

Copy link
Copy Markdown
Member

There are reports of the same on their twitter feed.

PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this pull request Sep 2, 2014
PierreBdR pushed a commit to PierreBdR/statsmodels that referenced this pull request Sep 2, 2014
…ric_rebased2

nonparametric examples and some fixes, followup to PR statsmodels#562
@bashtage bashtage added reference rejected Used for PRs with changes that are not acceptable labels Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

reference rejected Used for PRs with changes that are not acceptable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants