debug_mode=False) else: # cross_validation_indexes = list(cross_validation.KFold(len(train_mode_per_block)/10, n_folds=4, # random_state=42, shuffle=True)) def flatten_repetitions(data_to_flatten): return np.reshape( np.reshape(data_to_flatten.T * 10, (-1, 1)) + np.arange(10), (-1)) train_indexes = flatten_repetitions( cross_validation_indexes[0]) test_indexes = flatten_repetitions(cross_validation_indexes[1]) data_generator_batch = simple_data_generator_no_dict( all_data_per_char_as_matrix[train_indexes], target_per_char_as_matrix[train_indexes], shuffle_data=False) validation_data_generator_batch = simple_data_generator_no_dict( all_data_per_char_as_matrix[validation_indexes], target_per_char_as_matrix[validation_indexes], shuffle_data=False) from keras.models import Sequential from keras.layers import merge, Input, Dense, Flatten, Activation, Lambda, LSTM, noise eeg_sample_shape = (25, 55) only_p300_model_1 = get_only_P300_model_LSTM(eeg_sample_shape) only_p300_model_1.summary() use_p300net = False
select=select, debug_mode=False) else: # cross_validation_indexes = list(cross_validation.ShuffleSplit(len(train_mode_per_block)/10, n_iter=1, # test_size=.667, random_state=42)) # # def flatten_repetitions(data_to_flatten): # return np.reshape(np.reshape(data_to_flatten.T * 10, (-1, 1)) + np.arange(10), (-1)) # # train_indexes = flatten_repetitions(cross_validation_indexes[0][0]) # test_indexes = flatten_repetitions(cross_validation_indexes[0][1]) train_indexes = train_mode_per_block == 1 test_indexes = train_mode_per_block != 1 data_generator_batch = simple_data_generator_no_dict( all_data_per_char_as_matrix[train_indexes], target_per_char_as_matrix[train_indexes]) from keras.models import Sequential from keras.layers import merge, Input, Dense, Flatten, Activation, Lambda, LSTM, noise eeg_sample_shape = (25, 55) only_p300_model_1 = get_only_P300_model_LSTM(eeg_sample_shape) use_p300net = False if use_p300net: model = get_P300_model(only_p300_model_1, select=select) else: only_p300_model_1.compile(