예제 #1
0
 def PrepareRNNdataset(self):
     self.TRAIN_DATA_all, self.TRAIN_LABEL_all = lzy_utils.get_sub_sequences(
         self.TRAIN_DATA_all,
         self.TRAIN_LABEL_all,
         window_size=self.WINDOW_SIZE,
         step_size=self.STEP_SIZE)
     self.VAL_DATA_all, self.VAL_LABEL_all = lzy_utils.get_sub_sequences(
         self.VAL_DATA_all,
         self.VAL_LABEL_all,
         window_size=self.WINDOW_SIZE,
         step_size=self.STEP_SIZE)
     print('The dataset for RNN is prepared',
           '\nwhose shape of train set is', self.TRAIN_DATA_all.shape,
           '\nwhose shape of val set is', self.VAL_DATA_all.shape)
예제 #2
0
 def PrepareCNNdataset(self):
     data_seq_train_Oshape, self.TRAIN_LABEL_all = lzy_utils.get_sub_sequences(
         self.TRAIN_DATA_all,
         self.TRAIN_LABEL_all,
         window_size=self.WINDOW_SIZE,
         step_size=self.STEP_SIZE)
     self.TRAIN_DATA_all = np.reshape(
         data_seq_train_Oshape,
         newshape=(data_seq_train_Oshape.shape[0],
                   data_seq_train_Oshape.shape[1],
                   data_seq_train_Oshape.shape[2], 1))
     data_seq_val_Oshape, self.VAL_LABEL_all = lzy_utils.get_sub_sequences(
         self.VAL_DATA_all,
         self.VAL_LABEL_all,
         window_size=self.WINDOW_SIZE,
         step_size=self.STEP_SIZE)
     self.VAL_DATA_all = np.reshape(data_seq_val_Oshape,
                                    newshape=(data_seq_val_Oshape.shape[0],
                                              data_seq_val_Oshape.shape[1],
                                              data_seq_val_Oshape.shape[2],
                                              1))
     print('The dataset for CNN is prepared',
           '\nwhose shape of train set is', self.TRAIN_DATA_all.shape,
           '\nwhose shape of val set is', self.VAL_DATA_all.shape)
예제 #3
0
                     label_prep1[:, i] * selecteddatain_train.min(),
                     label_prep1[:, i] * selecteddatain_train.max(),
                     alpha=0.3)
plt.plot(t_train, selecteddatain_train)
plt.legend()
plt.show()

# ## Win_size=200, Step_size=10

# In[14]:

win_size = 200
step_leng = 10
data_seq_train_Oshape, label_seq_train = get_sub_sequences(
    selecteddatain_train,
    label_train_prep,
    window_size=win_size,
    step_size=step_leng)
data_seq_train = np.reshape(data_seq_train_Oshape,
                            newshape=(data_seq_train_Oshape.shape[0],
                                      data_seq_train_Oshape.shape[1],
                                      data_seq_train_Oshape.shape[2], 1))
data_seq_val_Oshape, label_seq_val = get_sub_sequences(selecteddatain_val,
                                                       label_val_prep,
                                                       window_size=win_size,
                                                       step_size=step_leng)
data_seq_val = np.reshape(data_seq_val_Oshape,
                          newshape=(data_seq_val_Oshape.shape[0],
                                    data_seq_val_Oshape.shape[1],
                                    data_seq_val_Oshape.shape[2], 1))