accuracy_score(Y_test[:, 1], Y_test_mlp_class)) print('The F1 of training set: ', f1_score(Y_train[:, 1], Y_train_mlp_class)) print('The F1 of testing set:', f1_score(Y_test[:, 1], Y_test_mlp_class)) #%% Results on whole line pred_tr_step = 1 '''prediction on gather''' #print('CWT-CNN:') #Y_pred_cwtc = f.pred(modelcwtc, s1,s1_labels, tw,tinc,method='cwt', # trace_step=pred_tr_step, dt=dt, freq_index=freq_index) print('CNN:') Y_pred_cnn = f.pred(modelcnn, s1, s1_labels, tw, tinc, method='cnn', trace_step=pred_tr_step, dt=dt) #print('DNN:') #Y_pred_dnn = f.pred(modeldnn, s1,s1_labels, tw,tinc, method='dnn', # trace_step=pred_tr_step, dt=dt) print('MLP: ') Y_pred = f.pred(mlp, s1, s1_labels, tw, tinc, method='mlp', trace_step=pred_tr_step, dt=dt)
Y_test_mlp_class = f.to_classes(Y_test_mlp[:,1], 0.5) print('The accuracy of training set: ', accuracy_score(Y_train[:,1], Y_train_mlp_class)) print('The accuracy of testing set:', accuracy_score(Y_test[:,1], Y_test_mlp_class)) print('The F1 of training set: ', f1_score(Y_train[:,1],Y_train_mlp_class)) print('The F1 of testing set:', f1_score(Y_test[:,1],Y_test_mlp_class)) #%% Classification results on whole line pred_tr_step = 1 '''prediction on gather''' print('CWT-CNN:') Y_pred_cwtc = f.pred(modelcwtc, s1,s1_labels, tw,tinc,method='cwt', trace_step=pred_tr_step, dt=dt, freq_index=freq_index) print('CNN:') Y_pred_cnn = f.pred(modelcnn, s1,s1_labels, tw,tinc, method='cnn', trace_step=pred_tr_step, dt=dt ) #print('DNN:') #Y_pred_dnn = f.pred(modeldnn, s1,s1_labels, tw,tinc, method='dnn', # trace_step=pred_tr_step, dt=dt) print('MLP: ') Y_pred = f.pred(mlp, s1,s1_labels, tw,tinc, method='mlp', trace_step=pred_tr_step, dt=dt ) #% '''plot the result on gather''' fig, ax = f.labels_plot(Y_pred_cwtc) ax.set_yticks(np.arange(0,int(nt/tw),2.5)-0.5) ax.set_yticklabels( ( (np.arange(0,int(nt/tw),2.5)-0.5)*tw+tw/2 )*dt )