covmats[i_matrix, i_channel] = np.nan covmats[i_matrix, :, i_channel] = np.nan all_corrup_channels.append(i_channel) all_n_corrup_channels[i_matrix] = n_corrupt_channels return covmats, all_n_corrup_channels, all_corrup_channels ############################################################################### # Generate data # ------------- rs = np.random.RandomState(42) n_matrices, n_channels = 100, 10 covmats = make_covariances(n_matrices, n_channels, rs, evals_mean=100., evals_std=20.) # Compute the reference, the Riemannian mean on all covariance matrices C_ref = mean_riemann(covmats) # Corrupt data randomly n_corrup_channels_max = n_channels // 2 print("Maximum number of corrupted channels: {} over {}".format( n_corrup_channels_max, n_channels)) covmats, all_n_corrup_channels, all_corrup_channels = corrupt( covmats, n_corrup_channels_max, rs) fig, ax = plt.subplots(nrows=1, ncols=1)
def _gen_cov_params(n_matrices, n_channels): return make_covariances(n_matrices, n_channels, rndstate, return_params=True)
"MeanField", ] classifiers = [ MDM(), KNearestNeighbor(n_neighbors=3), SVC(probability=True), MeanField(power_list=[-1, -0.25, 0, 0.25, 1]), ] n_classifs = len(classifiers) rs = np.random.RandomState(2022) n_matrices, n_channels = 50, 2 y = np.concatenate([np.zeros(n_matrices), np.ones(n_matrices)]) datasets = [(np.concatenate([ make_covariances(n_matrices, n_channels, rs, evals_mean=10, evals_std=1), make_covariances(n_matrices, n_channels, rs, evals_mean=15, evals_std=1) ]), y), (np.concatenate([ make_covariances(n_matrices, n_channels, rs, evals_mean=10, evals_std=2), make_covariances(n_matrices, n_channels, rs, evals_mean=12, evals_std=2) ]), y), make_gaussian_blobs(2 * n_matrices,
def _gen_cov_params(n_trials, n_chan): return make_covariances(n_trials, n_chan, rndstate, return_params=True)