Skip to content
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

Enh/adaptive kernel #462

Closed
wants to merge 14 commits into from
Closed

Conversation

essink
Copy link
Collaborator

@essink essink commented Mar 14, 2022

This pull request arose from #461

While investigating the issue, it seemed reasonable to restructure the code, such that intermediate results are easily accessible. A look into the originating package AdaptiveKDE showed, that the existing elephant code of estimating one fixed optimal kernel bandwidth (sskernel) could be easily extended cover the adaptive case (ssvkernel).

To avoid code duplications both cases were integrated into a class called KernelBandwidth.

(See original publication Shimazaki, H. & Shinomoto, S. Kernel bandwidth optimization in spike rate estimation. J Comput Neurosci 29, 171–182 (2010). for details)

Open TODOs:

  • Preliminary testing suggests that the code reproduces the results of AdaptiveKDE and the optimal_kernel_bandwidth function. But there is definitely need to check this systematically!
  • proper integration into the elephant.statistics.instantaneous_rate function
  • naming of the functions and variables was a bit ad-hoc and could be improved with a bit of thinking
  • remove old code

@pep8speaks
Copy link

Hello @essink! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 1495:1: W293 blank line contains whitespace
Line 1498:1: W293 blank line contains whitespace
Line 1501:1: E302 expected 2 blank lines, found 1
Line 1504:1: W293 blank line contains whitespace
Line 1519:1: E302 expected 2 blank lines, found 1
Line 1523:80: E501 line too long (81 > 79 characters)
Line 1533:80: E501 line too long (88 > 79 characters)
Line 1534:54: W291 trailing whitespace
Line 1569:1: E302 expected 2 blank lines, found 1
Line 1590:1: E302 expected 2 blank lines, found 1
Line 1593:1: E302 expected 2 blank lines, found 1
Line 1765:1: E302 expected 2 blank lines, found 1
Line 1799:1: W293 blank line contains whitespace
Line 1801:53: W291 trailing whitespace
Line 1802:46: E127 continuation line over-indented for visual indent
Line 1804:1: W293 blank line contains whitespace
Line 1811:1: W293 blank line contains whitespace
Line 1834:80: E501 line too long (83 > 79 characters)
Line 1835:80: E501 line too long (83 > 79 characters)
Line 1842:80: E501 line too long (88 > 79 characters)
Line 1843:44: E128 continuation line under-indented for visual indent
Line 1851:80: E501 line too long (88 > 79 characters)
Line 1852:44: E128 continuation line under-indented for visual indent
Line 1864:1: W293 blank line contains whitespace
Line 1866:5: E303 too many blank lines (2)
Line 1886:80: E501 line too long (85 > 79 characters)
Line 1892:80: E501 line too long (82 > 79 characters)
Line 1909:1: E302 expected 2 blank lines, found 1
Line 1910:75: W291 trailing whitespace
Line 1911:65: W291 trailing whitespace
Line 1912:80: E501 line too long (81 > 79 characters)
Line 1913:27: E251 unexpected spaces around keyword / parameter equals
Line 1913:29: E251 unexpected spaces around keyword / parameter equals
Line 1917:41: W291 trailing whitespace
Line 1925:1: W293 blank line contains whitespace
Line 1939:80: E501 line too long (91 > 79 characters)
Line 1940:37: E128 continuation line under-indented for visual indent
Line 1940:80: E501 line too long (83 > 79 characters)
Line 1951:1: W293 blank line contains whitespace
Line 1954:1: W293 blank line contains whitespace
Line 1956:1: W293 blank line contains whitespace
Line 1961:1: W293 blank line contains whitespace
Line 1963:37: E128 continuation line under-indented for visual indent
Line 1964:45: E127 continuation line over-indented for visual indent
Line 1965:1: W293 blank line contains whitespace
Line 1967:1: W293 blank line contains whitespace
Line 1972:1: W293 blank line contains whitespace
Line 1974:47: E261 at least two spaces before inline comment
Line 1977:32: E261 at least two spaces before inline comment
Line 1983:1: W293 blank line contains whitespace
Line 1986:80: E501 line too long (82 > 79 characters)
Line 1997:1: W293 blank line contains whitespace
Line 2004:1: W293 blank line contains whitespace
Line 2006:1: W293 blank line contains whitespace
Line 2011:1: W293 blank line contains whitespace
Line 2029:14: E261 at least two spaces before inline comment
Line 2033:1: W293 blank line contains whitespace
Line 2040:1: W293 blank line contains whitespace
Line 2045:80: E501 line too long (92 > 79 characters)
Line 2047:80: E501 line too long (92 > 79 characters)
Line 2048:1: W293 blank line contains whitespace
Line 2051:80: E501 line too long (82 > 79 characters)
Line 2060:80: E501 line too long (100 > 79 characters)
Line 2064:80: E501 line too long (81 > 79 characters)
Line 2073:80: E501 line too long (100 > 79 characters)
Line 2079:1: W293 blank line contains whitespace
Line 2082:1: W293 blank line contains whitespace
Line 2085:80: E501 line too long (80 > 79 characters)
Line 2086:1: W293 blank line contains whitespace
Line 2089:1: W293 blank line contains whitespace
Line 2091:1: W293 blank line contains whitespace
Line 2096:1: W293 blank line contains whitespace
Line 2100:80: E501 line too long (95 > 79 characters)
Line 2103:48: W291 trailing whitespace
Line 2104:80: E501 line too long (83 > 79 characters)
Line 2105:80: E501 line too long (84 > 79 characters)
Line 2115:1: W293 blank line contains whitespace
Line 2118:1: W293 blank line contains whitespace
Line 2124:1: W293 blank line contains whitespace
Line 2125:80: E501 line too long (121 > 79 characters)
Line 2126:1: W293 blank line contains whitespace
Line 2132:1: W293 blank line contains whitespace
Line 2133:37: W291 trailing whitespace
Line 2134:77: E261 at least two spaces before inline comment
Line 2134:80: E501 line too long (106 > 79 characters)
Line 2137:1: W293 blank line contains whitespace
Line 2139:1: W293 blank line contains whitespace
Line 2144:52: W291 trailing whitespace
Line 2145:1: W293 blank line contains whitespace
Line 2149:44: W291 trailing whitespace
Line 2150:1: W293 blank line contains whitespace
Line 2153:80: E501 line too long (88 > 79 characters)
Line 2156:76: W291 trailing whitespace
Line 2158:1: W293 blank line contains whitespace
Line 2160:1: W293 blank line contains whitespace
Line 2163:80: E501 line too long (98 > 79 characters)
Line 2167:80: E501 line too long (94 > 79 characters)
Line 2170:80: E501 line too long (89 > 79 characters)
Line 2171:1: W293 blank line contains whitespace
Line 2174:1: W293 blank line contains whitespace
Line 2178:1: W293 blank line contains whitespace
Line 2179:54: W291 trailing whitespace
Line 2183:1: W293 blank line contains whitespace
Line 2186:52: W291 trailing whitespace
Line 2189:80: W291 trailing whitespace
Line 2190:52: W291 trailing whitespace
Line 2192:80: E501 line too long (101 > 79 characters)
Line 2199:80: E501 line too long (87 > 79 characters)
Line 2200:60: W291 trailing whitespace
Line 2210:80: E501 line too long (87 > 79 characters)
Line 2211:60: W291 trailing whitespace
Line 2216:64: W291 trailing whitespace
Line 2220:1: W293 blank line contains whitespace
Line 2221:80: E501 line too long (81 > 79 characters)
Line 2223:80: E501 line too long (84 > 79 characters)
Line 2224:1: W293 blank line contains whitespace
Line 2229:1: W293 blank line contains whitespace
Line 2231:1: W293 blank line contains whitespace
Line 2236:1: W293 blank line contains whitespace
Line 2250:80: E501 line too long (113 > 79 characters)
Line 2263:1: W293 blank line contains whitespace
Line 2269:1: W293 blank line contains whitespace
Line 2270:80: E501 line too long (127 > 79 characters)
Line 2271:1: W293 blank line contains whitespace
Line 2271:1: W391 blank line at end of file

@Moritz-Alexander-Kern
Copy link
Member

Moritz-Alexander-Kern commented Dec 5, 2022

todo

@Moritz-Alexander-Kern Moritz-Alexander-Kern added the enhancement Editing an existing module, improving something label Dec 5, 2022
@coveralls
Copy link
Collaborator

coveralls commented Dec 7, 2022

Coverage Status

Coverage: 86.325% (-0.09%) from 86.418% when pulling cdbd26d on INM-6:enh/adaptive_kernel into 471bf0f on NeuralEnsemble:master.

@Moritz-Alexander-Kern Moritz-Alexander-Kern removed this from the v0.13.0 milestone Apr 24, 2023
@Moritz-Alexander-Kern
Copy link
Member

Stale, feel free to reopen if this project is continued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Editing an existing module, improving something
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] optimal_kernel_bandwidth yields extremely large kernel widths
4 participants