pyhrf.vbjde.vem_bold module¶
This module implements the VEM for BOLD data.
The function uses the C extension for expectation and maximization steps (see src/pyhrf/vbjde/utilsmodule.c file).
Notes
TODO: add some refs?
-
pyhrf.vbjde.vem_bold.
eps
¶ float – mimics the machine epsilon to avoid zero values
-
pyhrf.vbjde.vem_bold.
logger
¶ logger – logger instance identifying this module to log informations
-
pyhrf.vbjde.vem_bold.
jde_vem_bold
(graph, bold_data, onsets, durations, hrf_duration, nb_classes, tr, beta, dt, estimate_sigma_h=True, sigma_h=0.05, it_max=-1, it_min=0, estimate_beta=True, contrasts=None, compute_contrasts=False, hrf_hyperprior=0, estimate_hrf=True, constrained=False, zero_constraint=True, drifts_type='poly', seed=6537546)¶ This is the main function that computes the VEM analysis on BOLD data. This function uses optimized python functions.
Parameters: - graph (ndarray of lists) – represents the neighbours indexes of each voxels index
- bold_data (ndarray, shape (nb_scans, nb_voxels)) – raw data
- onsets (dict) – dictionnary of onsets
- durations (# TODO) – # TODO
- hrf_duration (float) – hrf total time duration (in s)
- nb_classes (int) – the number of classes to classify the nrls. This parameter is provided for development purposes as most of the algorithm implies two classes
- tr (float) – time of repetition
- beta (float) – the initial value of beta
- dt (float) – hrf temporal precision
- estimate_sigma_h (bool, optional) – toggle estimation of sigma H
- sigma_h (float, optional) – initial or fixed value of sigma H
- it_max (int, optional) – maximal computed iteration number
- it_min (int, optional) – minimal computed iteration number
- estimate_beta (bool, optional) – toggle the estimation of beta
- contrasts (OrderedDict, optional) – dict of contrasts to compute
- compute_contrasts (bool, optional) – if True, compute the contrasts defined in contrasts
- hrf_hyperprior (float) – # TODO
- estimate_hrf (bool, optional) – if True, estimate the HRF for each parcel, if False use the canonical HRF
- constrained (bool, optional) – if True, add a constrains the l2 norm of the HRF to 1
- drifts_type (str, optional) – set the drifts basis type used. Can be “poly” for polynomial or “cos” for cosine
- seed (int, optional) – seed used by numpy to initialize random generator number
Returns: - loop (int) – number of iterations before convergence
- nrls_mean (ndarray, shape (nb_voxels, nb_conditions)) – Neural response level mean value
- hrf_mean (ndarray, shape (hrf_len,)) – Hemodynamic response function mean value
- hrf_covar (ndarray, shape (hrf_len, hrf_len)) – Covariance matrix of the HRF
- labels_proba (ndarray, shape (nb_conditions, nb_classes, nb_voxels)) – probability of voxels being in one class
- noise_var (ndarray, shape (nb_voxels,)) – estimated noise variance
- nrls_class_mean (ndarray, shape (nb_conditions, nb_classes)) – estimated mean value of the gaussians of the classes
- nrls_class_var (ndarray, shape (nb_conditions, nb_classes)) – estimated variance of the gaussians of the classes
- beta (ndarray, shape (nb_conditions,)) – estimated beta
- drift_coeffs (ndarray, shape (# TODO)) – estimated coefficient of the drifts
- drift (ndarray, shape (# TODO)) – estimated drifts
- contrasts_mean (ndarray, shape (nb_voxels, len(contrasts))) – Contrasts computed from NRLs
- contrasts_var (ndarray, shape (nb_voxels, len(contrasts))) – Variance of the contrasts
- compute_time (list) – computation time of each iteration
- compute_time_mean (float) – computation mean time over iterations
- nrls_covar (ndarray, shape (nb_conditions, nb_conditions, nb_voxels)) – # TODO
- stimulus_induced_signal (ndarray, shape (nb_scans, nb_voxels)) – # TODO
- mahalanobis_zero (float) – Mahalanobis distance between estimated hrf_mean and the null vector
- mahalanobis_cano (float) – Mahalanobis distance between estimated hrf_mean and the canonical HRF
- mahalanobis_diff (float) – difference between mahalanobis_cano and mahalanobis_diff
- mahalanobis_prod (float) – product of mahalanobis_cano and mahalanobis_diff
- ppm_a_nrl (ndarray, shape (nb_voxels,)) – The posterior probability map using an alpha
- ppm_g_nrl (ndarray, shape (nb_voxels,)) – # TODO
- ppm_a_contrasts (ndarray, shape (nb_voxels,)) – # TODO
- ppm_g_contrasts (ndarray, shape (nb_voxels,)) – # TODO
- variation_coeff (float) – coefficient of variation of the HRF
- free_energy (list) – # TODO
Notes
See A novel definition of the multivariate coefficient of variation article for more information about the coefficient of variation.