Projection Example

Generating projection of the LDA classifiers based on the specified class.
# imports
from EEG_Familiarity import preproc
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
import matplotlib.pyplot as plt
# multiple group

file_path = "../data/data_CRMN_vs_MMN_imbalLDA_order_proj_1.mat"

data_preproc = preproc(file_path, experiment_num=1)
pos1, neg1 = data_preproc.filter_index(2,5,2,4)
pos2, neg2 = data_preproc.filter_index(4,5,4,4)

pos_idx, neg_idx = data_preproc.merge_two_class(pos1, neg1, pos2, neg2)
X, y, subject = data_preproc.get_data_by_index(pos_idx, neg_idx)

LDA = LinearDiscriminantAnalysis(shrinkage=None, solver="eigen")

pos_idx = [10, 11]
neg_idx = [8, 9]

data_preproc.generate_projections(LDA, pos_idx, neg_idx, X, y, subject, balance=True)
AttributeError: module 'matplotlib.pyplot' has no attribute 'set_xticks'

# multiple group

file_path = "../../../EEG-Familiarity-Prediction/data_imbalLDA_1.mat"

data_preproc = preproc(file_path, experiment_num=1)
pos1, neg1 = data_preproc.filter_index(2,5,2,4)
pos2, neg2 = data_preproc.filter_index(4,5,4,4)

pos_idx, neg_idx = data_preproc.merge_two_class(pos1, neg1, pos2, neg2)
X, y, subject = data_preproc.get_data_by_index(pos_idx, neg_idx)

LDA = LinearDiscriminantAnalysis(shrinkage=None, solver="eigen")

pos_idx = [10, 11]
neg_idx = [8, 9]

fig, axs = plt.subplots(5,2, figsize=(15, 25))
axs = axs.flatten()

for _ in range(10):
    data_preproc.generate_projections(LDA, pos_idx, neg_idx, X, y, subject, balance=True, plt=axs[_])