#get fMRI data and scanner RAS coordinates all_data = scipy.io.loadmat(file_name) data = all_data['data'] R = all_data['R'] # Z-score the data data = stats.zscore(data, axis=1, ddof=1) n_voxel, n_tr = data.shape # Run TFA with downloaded data from brainiak.factoranalysis.tfa import TFA # uncomment below line to get help message on TFA #help(TFA) tfa = TFA(K=5, max_num_voxel=int(n_voxel*0.5), max_num_tr=int(n_tr*0.5), verbose=True) tfa.fit(data, R) print("\n centers of latent factors are:") print(tfa.get_centers(tfa.local_posterior_)) print("\n widths of latent factors are:") widths = tfa.get_widths(tfa.local_posterior_) print(widths) print("\n stds of latent RBF factors are:") rbf_std = np.sqrt(widths/(2.0)) print(rbf_std)
print("File download failed:", e, file=sys.stderr) #get fMRI data and scanner RAS coordinates all_data = scipy.io.loadmat(file_name) data = all_data['data'] R = all_data['R'] # Z-score the data data = stats.zscore(data, axis=1, ddof=1) n_voxel, n_tr = data.shape # Run TFA with downloaded data from brainiak.factoranalysis.tfa import TFA # uncomment below line to get help message on TFA #help(TFA) tfa = TFA(K=5, max_num_voxel=int(n_voxel * 0.5), max_num_tr=int(n_tr * 0.5), verbose=True) tfa.fit(data, R) print("\n centers of latent factors are:") print(tfa.get_centers(tfa.local_posterior_)) print("\n widths of latent factors are:") widths = tfa.get_widths(tfa.local_posterior_) print(widths) print("\n stds of latent RBF factors are:") rbf_std = np.sqrt(widths / (2.0)) print(rbf_std)