def test_knn_threshold(self): # filename = '../../data/subject1_csv/eeg_200605191428_epochs/small.csv' filename = '../../data/emotiv/EEG_Data_filtered.csv' dataset = DataReader.read_data(filename, ',') dataset_slice = DataSet(dataset[0:40]) artificer = Artificer(dataset_slice, add_artifacts=True) threshold = artificer.knn_threshold() artificer.pca_reconstruction(threshold) artificer.visualize()
def test_pca(self): # filename = '../../data/subject1_csv/eeg_200605191428_epochs/small.csv' filename = '../../data/emotiv/EEG_Data_filtered.csv' dataset = DataReader.read_data(filename, ',') threshold = 0 for idx in range(len(dataset) // 40): current_dataset = DataSet(dataset[idx * 40:(idx + 1) * 40]) if idx < 10: artificer = Artificer(current_dataset, add_artifacts=False) max_eigenvalue, rejected = artificer.pca_reconstruction() threshold = max(threshold, max_eigenvalue) else: artificer = Artificer(current_dataset, add_artifacts=True) artificer.pca_reconstruction(threshold) artificer.visualize() break