elephant icon indicating copy to clipboard operation
elephant copied to clipboard

[Bug] CAD output is not the same as original MATLAB Version

Open Peyman7 opened this issue 3 years ago • 4 comments

Describe the bug CAD cell assembly detection method output is not the same as the original MATLAB version provided by the article's author. I have checked the source codes, and found the parameter alpha in the " # testing for higher order assemblies" part gives the wrong value as it should take the original alpha=0.05 in the right side. alpha = alpha / float(len(w2_to_test) * n_as * (2 * max_lag + 1)) As alpha in previous lines recalled and its value is changed because of same alpha values in both side of equation, it should be changed in a way that the value of alpha in the right side always is be the same is the alpha input parameter.

To Reproduce As alpha parameter name in input parameter may be changed to alph (as well as the same MATLAB version) and alpha parameter in the right side of alpha = alph/ float(len(w2_to_test) * n_as * (2 * max_lag + 1)) changes to alph.

Environment

  • OS: Windows
  • How you installed elephant (`pip):
  • Python version: 3.9.6
  • elephant python package version: 0.10.0

Environment

  • OS (e.g., Linux):
  • How you installed elephant (conda, pip, source):
  • Python version:
  • neo python package version:
  • elephant python package version:
  • (Any additional python package you want to include here)

Peyman7 avatar Jan 15 '22 01:01 Peyman7

Hey, thanks for your detailed report. If I understand correctly this issue seems to be related to the name used for the variable/parameter producing unwanted behavior. This needs some investigation, we will look into it.

Moritz-Alexander-Kern avatar Jan 17 '22 11:01 Moritz-Alexander-Kern

you've pointed to line: https://github.com/NeuralEnsemble/elephant/blob/6ed3cb3089783035885e2fbec1fff535df7369cd/elephant/cell_assembly_detection.py#L363

another change to alpha seems to occur here: https://github.com/NeuralEnsemble/elephant/blob/6ed3cb3089783035885e2fbec1fff535df7369cd/elephant/cell_assembly_detection.py#L255

I suggest creating a validation test based on the original MATLAB implementation as a regression test. Is this the MATLAB-implementation provided by the author you are using: https://github.com/DurstewitzLab/Cell-Assembly-Detection ?

Moritz-Alexander-Kern avatar May 11 '22 12:05 Moritz-Alexander-Kern

Yes, that link is the original MATLAB code published by the article's main author.

Peyman7 avatar Jun 01 '22 23:06 Peyman7

Hi,

That’s a good idea! Regarding the original MATLAB code link, you have pointed the correct link.

Cheers, Peyman

On May 11, 2022, at 06:46, Moritz Kern @.***> wrote:

 you've pointed to line: https://github.com/NeuralEnsemble/elephant/blob/6ed3cb3089783035885e2fbec1fff535df7369cd/elephant/cell_assembly_detection.py#L363

another change to alpha seems to occur here: https://github.com/NeuralEnsemble/elephant/blob/6ed3cb3089783035885e2fbec1fff535df7369cd/elephant/cell_assembly_detection.py#L255

I suggest creating a validation test based on the original MATLAB implementation as a regression test. Is this the MATLAB-implementation provided by the author you are using: https://github.com/DurstewitzLab/Cell-Assembly-Detection ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

Peyman7 avatar Oct 11 '22 08:10 Peyman7