ENH: vectorize loo function for local_constant estimator #9199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NumPy's guide.
This is a performance improvement for bandwidth estimation using leave one out cross-validation for local constant estimators. A method
cv_loo_fast
is added which is only used whenreg_type
is 'lc'. The idea is to calculate the leave-on-out estimations by using matrix multiplication instead of using a loop. In general, I see a 2~2.5 times of speed up for <=1000 rows of data. When using only continuous gaussian kernel, the speed up is more than 6 times due to a further vectorization in calculating the product kernel function.Notes:
needed for doc changes.
then show that it is fixed with the new code.
verify you changes are well formatted by running
flake8
is installed. This command is also available on Windowsusing the Windows System for Linux once
flake8
is installed in thelocal Linux environment. While passing this test is not required, it is good practice and it help
improve code quality in
statsmodels
.