def __init__(self, subjects=SUBJECTS, series=SERIES): training_ds = IOutils.data_streamer(patients_list=subjects, series_list=series) all_data = list(training_ds) X,Y = zip(*all_data) self.data = X[0] self.events = Y[0] self.mean = self.data.mean(axis=0) self.std = self.data.std(axis=0) self.normalize()
#IOutils.LABEL_NAMES has all the classes we wish to predict #HI # initialize logistic regressors LRs = {} LRsprocessed = {} for label_name in IOutils.LABEL_NAMES: # each label will have its own logistic regressor LRs[label_name] = LogisticRegression() LRsprocessed[label_name] = LogisticRegression() print('Initialized logistic regressors') # Load training data # load 1 trial each from 3 patients train_data = IOutils.data_streamer(mode='train', num_patients=1, num_series=8) filters = ['alpha', 'beta'] # obtain a validation set X_valid, Y_valid = train_data.next() # X_valid = X_valid[] selected_channels = range(X_valid.shape[1]) # selected_channels = [3,4] X_valid = X_valid[:,selected_channels] # print Y_valid # X_valid = np.array(X_valid) Y_valid = np.array(Y_valid)
] # In[4]: nn = NeuralNet(layers_list, max_epochs=30, update=nesterov_momentum, update_learning_rate=0.02, verbose=1000, **LF.kwargs) # In[5]: training_ds = IOutils.data_streamer(patients_list=[2], series_list=range(1,7)) # nn = BasicCNN(input_shape=(None,42), output_num_units=12, max_epochs=50, hidden=[256, 120], add_drops=[1,1]) vt = IOutils.VectorTransformer() # In[ ]: n_repeat_sampling = 1 dataset_count = 0 for X,Y in training_ds: X = X.astype(np.float) X[np.isnan(X)] = 0 X = X/X.max() wg = window_generator_ND(X, window_size=WINDOW_SIZE) dataset_count += 1 # transform the Ys