Open SergejKr opened 9 months ago
Thanks for letting me know. If someone wants to look into this, I will happily merge a PR
Hi all, I also had this problem. However, I am reluctant to submit a PR as I do not fully understand the ins-and-outs of this (excellent!!) library and its capabilities, . The warning appears when calculating the practical support for kernels with infinite supports. Here is where is happens for my problem:
kernel_funcs.py @ line 294 (v1.1.8):
def f(x):
return self.evaluate(x, bw=bw) - atol # <--- HERE!!!
try:
xtol = 1e-3
ans = brentq(f, a=0, b=8 * bw, xtol=xtol, full_output=False)
return ans + xtol
The warning happens as f(x) returns an array. I think that this can be fixed (for my problem at least) by simply returning the first element, e.g.:
def f(x):
return self.evaluate(x, bw=bw)[0] - atol
However, this will not work if bw is not a float (a brief look at the code seems to imply that bw could be an array... is that correct?). As I did not study the code sufficiently, I am reluctant to formally propose this fix. What do you think?
I looks like you're onto something! Makes sense that the f
that goes into brentq should return a number and not a 1-element array. If you add something like self.evaluate(x, bw=bw)[0]
and the test suite passes, then I would consider the problem solved.
Please do propose a fix! If tests pass with no FutureWarning then we're good!
Thank you for your support. While the mod fixed my problem, warnings were raised while running test_api.py, likely coming from the usage of brentq in bw_selection.py. I will investigate and try to propose a fix when I have free time.
Hello everyone,
I am getting the following FutureWarning:
A minimal example to reproduce the behaviour:
I am using the version 1.1.8 of KDEpy and 1.26.4 of numpy.