Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses.
The 1 match
- [1] § Methods › Simulations › 3. Scaling and Noise ↔ micorr/simulation/testing.py, lines 19–88 · score 0.53 · noise ratio, standard deviation, outlier, transformations, SNR, simulations
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Python · 258 lines · 10 KB · GPL-3.0 · 1 match
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Tue Mar 4 12:21:16 2025
- @author: anni
- """
- from . import transformations, simulations
- from ..snr import snr_func
- from tqdm import tqdm
- import numpy as np
- import matplotlib.pyplot as plt
- import os
- import pandas as pd
- import pickle
- def test_estimators(base_signal1,
- base_signal2=None,
- scaling_func=simulations.max_scaling,
- changes=None,
- trans_func=None,
- outliers= None,
- z_score = [3,5],
- estimator_list=None,
- compare_with_noise=False,
- n_runs=1000,
- snr_db=10,
- add_noise=[1,1],
- base_snr=False):
- '''
- Test similarity estimatore by applying transformations, adding noise, or adding outliers to a base signal.
- Only one of the following can be used per function call:
- - trans_function: to ba a transformation to the signal.
- - outliers: to add outlier to the signal.
- - compare_with_noise: to compare the signal with pure noise.
- - `snr_db = None`: to vary the signal-to-noise ratio across runs.
- These options are mutually exclusive. If more than one is specified, a ValueError is raised.
- Parameters
- ----------
- base_signal : np.array
- A noise free base signal that will be transformed.
- scaling_func: callable or None
- A function used to scale the signals.
- if None no scaling is applied.
- By default scaling based on the shared maximum value of the two signals is applied.
- changes : list
- A list of transformation values to test
- (e.g., noise levels, transformation magnitudes, number of outliers).
- trans_function : callable or None, optional
- A function applied the transform the signal.
- The provided function should return both two signals to be compared.
- If None no transformation applied. The default is None.
- outliers : None or lstr
- Whether outliers are added.
- If None no outliers are added.
- If 'one' outliers are added into base_signal1.
- If 'both'outliers are added into both of the signals.
- The default is None.
- compare_with_noise: bool or int
- If a float is provided, the signal is compare with a pure noise signal with that standard deviation.
- If False (default) noise comparision is not done.
- n_runs : int, optional
- Number of iteration to run the simulation. The default is 1000.
- snr_db : int, optional
- The signal to noise ratio of the simulated signal after the random noise is added.
- If None the noise is changed based on the changes parameter.
- The default is 10.
- add_noise: list, optional
- Whether the noise is added into both of the signals or only first of the signals.
- One in the list means that the noise will be added into that signal.
- base_snr: bool, optional
- If True the SNR will de defined based on the given base signal.
- If False (default) the transformed signal will be used to define the SNR
- Returns
- -------
- results : dict
- A dictionary containing the results of the given similarity estimators
- across iterations where random noise is added
- while changing the given transformation parameter.
- '''
- # Ensuring that the user tries to do only one of the options
- mode_flags = [
- trans_func is not None,
- outliers is not None,
- compare_with_noise not in [False, None],
- snr_db is None]
- if sum(mode_flags) > 1:
- raise ValueError("Only one of the following can be used at a time: trans_function, outliers, "
- "compare_with_noise, or setting snr_db=None.")
- # Initializing dictionaries for the estimator results
- if changes is not None:
- results = {estimator: {} for estimator in estimator_list}
- else:
- changes = [None]
- results = {estimator: [] for estimator in estimator_list}
- if base_signal2 is None:
- base_signal2 = base_signal1
- if base_snr:
- before_trans = base_signal1
- before_trans_scaled, _ = scaling_func(before_trans, before_trans)
- # Tracking the progress of the calculations
- n_total = len(changes) * n_runs * len(estimator_list)
- with tqdm(total=n_total, desc='Total Progress') as pbar:
- # Looping through the different values applied in the transformations
- for change in changes:
- # transformation applied across the changes
- if trans_func:
- transformed1, transformed2 = trans_func(base_signal1, change)
- else:
- transformed1, transformed2 = base_signal1, base_signal2
- # Scaling
- if scaling_func:
- scaled1, scaled2 = scaling_func(transformed1, transformed2)
- # Adding random noise in n_runs iterations
- for i in range(n_runs):
- # When snr_db is spet to None we change the SNR level
- snr_aim = snr_db if snr_db is not None else change
- # Adding noise into base signal
- if add_noise[0] == 1:
- if base_snr == False:
- noise1, _ = snr_func.snr_to_noise(snr_aim, scaled1)
- else:
- noise_std = snr_func.snr_to_std(snr_db, before_trans_scaled)
- noise1 = np.random.normal(0, noise_std, size=len(scaled1))
- noisy_signal1 = scaled1 + noise1
- else:
- noisy_signal1 = scaled1
- # Do we compare with the noise signal
- if compare_with_noise:
- noisy_signal2 = np.random.normal(np.mean(scaled1), np.std(scaled1), size=len(noisy_signal1))
- # We compare with the transformed signal
- else:
- # If it is defined that the noise is added into both of the signals
- if add_noise[1] == 1:
- if base_snr == False:
- noise2, _ = snr_func.snr_to_noise(snr_aim, scaled2)
- else:
- noise_std = snr_func.snr_to_std(snr_db, before_trans_scaled)
- noise2 = np.random.normal(0, noise_std, size=len(scaled1))
- noisy_signal2 = scaled2 + noise2
- else:
- noisy_signal2 = scaled2
- # Possible outliers are added
- if outliers in ('one', 'both'):
- noisy_signal2 = transformations.add_outliers(noisy_signal2, change, zscore_range=z_score)
- if outliers == 'both':
- noisy_signal1 = transformations.add_outliers(noisy_signal1, change, zscore_range=z_score)
- # Calculating the results with the different estimators
- for estimator in estimator_list:
- estimator_function = estimator_list[estimator]
- estimator_value = estimator_function(noisy_signal1, noisy_signal2)
- # Adding change as a key when changes are used
- if change is not None:
- results[estimator].setdefault(change, []).append(float(estimator_value))
- else:
- results[estimator].append(estimator_value)
- pbar.update(1)
- return results
- def test_est_params(comp1, comp2,
- est, param_name, param_values,
- snr, n_runs=1_000, scaling_func=simulations.max_scaling):
- '''
- Testing how the choice of freeparameter impacts on the results of the different MI estimators.
- Parameters
- ----------
- comp1: np.array
- First signal to compare with the given estimator.
- comp2: np.array or float
- Second signal to compare with the given estimator.
- If a float is provided, a random noise signal is generated with the specified
- standard deviation (the float value) and the same length as `comp1`,
- and this noise signal is used as the second signal.
- est: callable
- Function of the estimator the be tested.
- param_name:
- The name of the freeparameter ti be changed in the given estimator function.
- param_values: list
- List of the free parameter values to test.
- snr: int
- Noise level (dB) to add in the given signals.
- n_runs: int, optional
- Number of iteration to run the simulation. The default is 1000.
- scaling_func: callable, optional
- A function used to scale the signals.
- if None no scaling is applied.
- By default scaling based on the shared maximum value of the two signals is applied.
- Returns
- -------
- param_results : dict
- A dictionary containing the results of the given similarity estimator
- across iterations where random noise is added
- while changing the given free parameter of the estimator.
- '''
- if scaling_func:
- comp1, comp2 = scaling_func(comp1, comp2)
- param_results = {}
- n_total = n_runs * len(param_values)
- with tqdm(total=n_total, desc='Total Progress') as pbar:
- for param in param_values:
- est_results = []
- for _ in range(n_runs):
- n1, _ = snr_func.snr_to_noise(snr, comp1)
- comp1_noise = comp1 + n1
- if isinstance(comp2, (float)):
- comp2_noise = np.random.normal(0, comp2, size=len(comp1))
- else:
- n2, _ = snr_func.snr_to_noise(snr, comp2)
- comp2_noise = comp2 + n2
- est_result = est(comp1_noise, comp2_noise, **{param_name: param})
- est_results.append(est_result)
- pbar.update(1)
- param_results[param] = est_results
- return param_results
- def save_sim_results(results, save_path):
- with open(save_path, 'wb') as f:
- pickle.dump(results, f)
- def get_sim_results(data_path):
- with open(data_path, 'rb') as f:
- results = pickle.load(f)
- return results
testing.py at commit a1c8fee, under GPL-3.0 · at the source
Overview
Abstract
In neural evoked responses, small variations in the timing or duration of responses can be observed when the same functional response is recorded in different trials, different experimental conditions or by different sensors. These variations limit the ability of correlation-based methods to detect similarities between signals. Mutual information (MI) provides an alternative similarity measure, capable of capturing both linear and non-linear dependencies, yet its practical use is hindered by lack of consensus on estimators for continuous data and the limited understanding of the behavior of the estimators on realistic signals. In this work, we investigate how to estimate the similarity of neural evoked responses by systematically comparing sample Pearson correlation with three of the most common MI estimators. We describe their behavior using both simulated signals and real magnetoencephalographic data. In the simulations, the estimators are tested against a set of transformations that depict realistic changes in neural evoked responses. Subsequently, we propose guidelines for defining adaptive lower bounds on the similarity estimates and analyzing the similarity rankings induced by the different estimators. Our findings reveal trade-offs between measures sensitivity and different signal properties. We confirm that Pearson correlation is reliable in describing linear relationships for low-noise signals, and we identify parameter settings that stabilize MI estimators, enabling them to capture complex signal dependencies. Together, these results introduce practical parameter choices and thresholding strategies for mutual information and provide guidance for selecting and interpreting similarity measures in the analysis of neural evoked time series.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.
AaltoImagingLanguage/micorr
a1c8fee015bef424d41b173359fc39bb11178d0d, 14 April 2026Availability: 1 check, the latest on 26 September 2026: the link answers
- 26 September 2026: the link answers
29 files
- freeparameter_testing/
test_parameters.py , Python, 94 lines - micorr/
__init__.py , Python, 9 lines - micorr/
estimators/ , Python, 7 lines__init__.py - micorr/
estimators/ , Python, 74 linesbinning.py - micorr/
estimators/ , Python, 23 linescorr_est.py - micorr/
estimators/ , Python, 194 linesmi_estimators.py - micorr/
realdata/ , Python, 1 line__init__.py - micorr/
realdata/ , Python, 54 linesch_locs.py - micorr/
realdata/ , Python, 281 linesplotting.py - micorr/
realdata/ , Python, 109 linestest_est.py - micorr/
simulation/ , Python, 8 lines__init__.py - micorr/
simulation/ , Python, 236 linesplotting.py - micorr/
simulation/ , Python, 154 linessimulations.py - micorr/
simulation/ , Python, 258 lines, 1 matchtesting.py - micorr/
simulation/ , Python, 156 linestransformations.py - micorr/
snr/ , Python, 6 lines__init__.py - micorr/
snr/ , Python, 26 linessnr_func.py - realdata_example/
audiovisual_example.py , Python, 105 lines - transformations_examples
/ , Python, 1 line__init__.py - transformations_examples
/ , Python, 107 linesdur_sim.py - transformations_examples
/ , Python, 121 linesinfo_sim.py - transformations_examples
/ , Python, 110 linesoutlier_sim.py - transformations_examples
/ , Python, 76 linespara_sim.py - transformations_examples
/ , Python, 108 linesqua_sim.py - transformations_examples
/ , Python, 122 linessampsize_sim.py - transformations_examples
/ , Python, 102 linesshift_sim.py - transformations_examples
/ , Python, 89 linessnr_sim.py - LICENSE, License, 674 lines
- README.md, Text, 57 lines
Code Availability
The code used to generate the simulated data is publicly available at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 27 scripts, each with its path and the digest of its content;
- 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
No dataset and no data link were found in the paper.
Data Availability
The code used to generate the simulated data is publicly available at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 3, 28 September 2026
- Publisher: n/a → Springer Science+Business Media
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 6 keywords, 8 MeSH terms, 1 funder, 42 references.
Cite
This paper
Hukari, A., Cotroneo, S. F., & Salmelin, R. (2026). Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses. Neuroinformatics, 24(4), 61. https://
BibTeX
@article{hukari2026estim
author = {Hukari, Anni and Cotroneo, Silvia Federica and Salmelin, Riitta},
title = {{Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses}},
journal = {Neuroinformatics},
year = {2026},
month = sep,
volume = {24},
number = {4},
pages = {61},
publisher = {Springer Science+Business Media},
issn = {1539-2791},
doi = {10.1007/
url = {https://
pmid = {42747602},
pmcid = {PMC13582061}
}
RIS
TY - JOUR
AU - Hukari, Anni
AU - Cotroneo, Silvia Federica
AU - Salmelin, Riitta
TI - Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses
T2 - Neuroinformatics
J2 - Neuroinformatics
PY - 2026
DA - 2026/
VL - 24
IS - 4
SP - 61
SN - 1539-2791
PB - Springer Science+Business Media
DO - 10.1007/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1007/
"type": "article-journal",
"title": "Estimating Mutual Information and Pearson Correlation on Neural Evoked Responses",
"container-title": "Neuroinformatics",
"author": [
{
"family": "Hukari",
"given": "Anni"
},
{
"family": "Cotroneo",
"given": "Silvia Federica"
},
{
"family": "Salmelin",
"given": "Riitta"
}
],
"container-title-short":
"volume": "24",
"issue": "4",
"page": "61",
"DOI": "10.1007/
"PMID": "42747602",
"PMCID": "PMC13582061",
"ISSN": "1539-2791",
"publisher": "Springer Science+Business Media",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
9,
16
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1002/hbm.70628 [code]
- EEG Biomarkers for Affective Disorders Diagnosis: An Evaluation and Validation Study.Journal: Human brain mappingIn common: MNE-Python, scikit-learn, pandas, 3 other tools, 3 references
- [2] doi:10.1016/j.patter.2026.101619 [code]
- Sampling bias corrections for discrete and Gaussian partial information decompositions.Journal: Patterns (New York, N.Y.)In common: scikit-learn, pandas, SciPy, 2 other tools, 3 references
- [3] doi:10.1371/journal.pone.0348005 [code]
- THOI: An efficient and accessible library for computing higher-order interactions enhanced by batch-processing.Journal: PloS oneIn common: scikit-learn, pandas, SciPy, 2 other tools, 3 references
- [4] doi:10.1093/nc/niag029 [code]
- A data-driven approach to identifying and evaluating connectivity-based neural correlates of conscious visual perception.Journal: Neuroscience of consciousnessIn common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG, 1 reference
- [5] doi:10.1162/imag.a.1269 [code]
- From early to contemporary normative modeling: Mapping individual differences in neurophysiological signals.Journal: Imaging neuroscience (Cambridge, Mass.)In common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG, computational
- [6] doi:10.1073/pnas.2536563123 [code]
- Temporally structured motor and auditory representations in covert syllable production.Journal: Proceedings of the National Academy of Sciences of the United States of AmericaIn common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
- [7] doi:10.1038/s41467-026-75240-0 [code]
- Dynamic acoustic-to-categorical representations of phonemes and prosody along ventral and dorsal speech streams.Journal: Nature communicationsIn common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
- [8] doi:10.1523/eneuro.0041-26.2026 [code]
- Ocular Speech Tracking Persists in Blindness, but Its Dynamics and Oculo-Cerebral Connectivity Depend on Visual Status.Journal: eNeuroIn common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
- [9] doi:10.1038/s41467-026-74824-0 [code]
- Learning regularities in noise engages both neural predictive activity and representational changes.Journal: Nature communicationsIn common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
- [10] doi:10.1523/eneuro.0344-25.2026 [code]
- Long-Term Variability in Visual Processing versus Perceptual Stability.Journal: eNeuroIn common: MNE-Python, scikit-learn, pandas, 3 other tools, MEG
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 27 scripts, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:9cc9f11d28572979…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
