New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KernelReg performance in a for loop #4187
Comments
KernelReg is slow, and with bandwidth selection it is even slower. My guess is that you don't need the extra features of KernelReg and a faster substitute would work better in this case. First, can you add or post somewhere one of your datasets/profiles, mainly because this one of related type of usecases that I want to look into (eventually). For related smoothing:
without smoothing (There might be also other ways to estimate this in a relatively robust way, e.g. assuming Poisson noise, but I don't have any experience in what works well in cases like these.) |
I just saw https://stackoverflow.com/questions/48069998/kernelreg-performance-in-a-for-loop |
Yes. |
You can also post your answer to stackoverflow. |
I have a solution to speed up bw estimation for Nadaraya–Watson kernel regression (local constant reg_type). The idea is to vectorize the cv_loo method, and I can achieve in general 2x~2.5x speed up for hundreds to a thousand rows of 3-dimensional data (can't do more rows/dimension because my current machine is basically a tablet). For Gaussian kernel and continuous var_type, I can achieve 50x speed up (a few hundreds row) and ~7x speed up for 1000 rows. This obviously do not solve all the performance issues with kernel regression as there is no change to the fit function, and it only works for local constant reg_type. Can I still raise a pull request for this partial solution? |
Please open a PR. |
Should I tag someone to review this? Any comment would be appreciated. |
Hi, everyone
So sorry to post this under Issues, I can't enter google account and mailing list.
I'm new in python. I have a task to fit many 1D profile(about 10000 profiles) obtained from electron beam to Gaussian.
Since the raw data is basically very noisy, I had to denoise before fitting, and KernelReg is a good way to do this as far as I know(in fact, I Know little for denoising).
For each profile, I firstly call KernelReg and then lmfit to extract the center, sigma, amp and offset of raw data in a for loop.
However, depending on the test of 100 data, if I use only lmfit the runtime is 2.4 seconds(cprofiler), and if combining KernelReg and lmfit the runtime would be 272 seconds.
The cprofiler displays a bottleneck in the KernelReg call.
So, my question is how to improve the performance of KernelReg call, and is this a good choice for denoising and fit using KernelReg+lmfit?.
Best Regards!
The text was updated successfully, but these errors were encountered: