#drama_all = np.array(drama_all) #np.save('../outputs/uns_drama_'+file_name+'_'+str(i),drama_all) #np.save('../outputs/uns_lof_'+file_name+'_'+str(i),lof_all) #np.save('../outputs/uns_ifr_'+file_name+'_'+str(i),ifr_all) cond = True while cond: try: X, y = batch() res = drm.unsupervised_outlier_finder_all(X) arr, drts, metrs = drm.result_array(res, y, 'real') drama_all.append(arr) df = drm.sk_check(X, X, y, [1]) for k, scr in enumerate(['AUC', 'MCC', 'RWS']): lof_all[k] = df[scr][0] ifr_all[k] = df[scr][1] drama_all = np.array(drama_all) np.save('../outputs/uns_drama_' + file_name + '_' + str(i), drama_all) np.save('../outputs/uns_lof_' + file_name + '_' + str(i), lof_all) np.save('../outputs/uns_ifr_' + file_name + '_' + str(i), ifr_all) cond = False except: pass
#outliers = X[y!=i_sig] #outliers_y = y[y!=i_sig] #for i in range(0,45,5): # ax1.plot(inliers[i],'b') # ax2.plot(outliers[i],drm.COLORS[outliers_y[i]]) # #plt.subplots_adjust(hspace=0.3,left=0.1, right=0.9, top=0.9, bottom=0.1) #plt.savefig('1.jpg') y = (y != i_sig).astype(int) y = y[:, None] if n_train == 0: res = drm.unsupervised_outlier_finder_all(X) df = drm.sk_check(X, X, y, [1]) auc = [] mcc = [] rws = [] for i in range(50): for j in ['real', 'latent']: o1 = res[j][i] auc.append(drm.roc_auc_score(y == 1, o1)) mcc.append(drm.MCC(y == 1, o1)) rws.append(drm.rws_score(y == 1, o1)) # print(y==1) auc = np.array(auc) mcc = np.array(mcc) rws = np.array(rws) drm.save(dir_add + str(i_sig) + '_' + str(n_train) + '_' + str(nn),