BUG: nonparametric: kernel, efficient=True changes bw even if given #597

josef-pkt opened this Issue Jan 4, 2013 · 5 comments


None yet

3 participants


example for KernelCensoredReg, but I think this is generic

using the following changes the bw from the one given

bw=[0.23, 434697.22],

without efficient=True the bandwidth stays the same as the one given

rgommers commented Jan 4, 2013

Were you planning to attach an example and/or diff here?


I think I used this example https://gist.github.com/4449108/4f224e41282da9d0edd8e1c56f38f211a2fc1fe4
with and without commenting the line with defaults in model first model in script.

Padarn commented Apr 22, 2014

I took a look into this. It seems like the function _compute_efficient in _kernel_base.py computes a plug-in type bandwidth whether or not there is a bandwidth specified. In fact, it uses the same rule regardless of what 'bw' is specified to be.

Can't quite tell what the code in _compute_efficient is trying to do, but the bug could easily be fixed by adding a flag telling it to return the user selected bandwidth if given.


I opened these issues as a user that was just pushing buttons without understanding the code.

based on a brief look while still not understanding the details:

I guess we have the same problem in KDEMultivariate

If the user sets bw explicitly, as an array, then we shouldn't call any bandwidth calculation method at all. so we should never even get to _compute_efficient

Can you adjust a KDEMultivariate example or test case, and see if the same problem is there?
and we can covert it to a test case for those options.

Padarn commented Apr 23, 2014

Sure: https://gist.github.com/Padarn/11231981, this does indeed have the same problem.

I'm going to add a flag to stop _compute_efficient from doing this when a user bw is given, but I don't really like the way the bandwidth is handled anyway.. perhaps I'll submit an enhancement once bug week is over.

@josef-pkt josef-pkt closed this in 3adaa1a May 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment