megicparc.functions.compute_cosine_similarity

megicparc.functions.compute_cosine_similarity(fwd)

Define cosine similarity s_ij^c

Parameters:

fwdinstance of Forward

The forward solution

Returns:

cosine_similarityndarray of float, shape (n_sources, n_sources)

Similarity matrix s_ij^c

Notes:

For each pair of points in the source-space, i, j = 1, …, n,

s_ij^c = | 1/S sum_{s=1}^S s_ij^c(s) |

where S is the number of sensor types present in the forward model, and s_ij^c(s) is the cosine similarity between i-th and j-th columns of the leadfield for sensor type s.