data = np.load(file) print(file) data_x = data['x'].astype(np.float32) data_y = data['y'].astype(np.int32) if np.unique(data_y).shape[0]<=16: f = open("results/auctable.tex","a") f.write("\\multirow{3}{*}{%s} " % (dataset_descriptions[file])) fname = file[5:-4] ftnet = ClassifierGenerator(128, 16, NETSIZE=384).cuda() ftnet.load_state_dict(torch.load("models/classifier-generator-128-16-%s.pth" % fname)) if data_x.shape[0]>=20: f.write("& 10 ") results10 = np.array(compareMethodsOnSet(methods + [ lambda: NetworkSKL(ftnet) ], data_x, data_y, N=10, samples=800)) stdev = np.mean(results10[:,3]) maxval = np.max(results10[:,1]) f.write("& %.3g " % stdev) for i in range(results10.shape[0]): if abs(maxval-results10[i,1])<stdev: f.write("& \\bf{%.3g} " % (results10[i,1])) else: f.write("& %.3g " % (results10[i,1])) f.write("\\\\ \n") avg10.append(results10) if data_x.shape[0]>=60: f.write("& 50 ") results50 = np.array(compareMethodsOnSet(methods + [ lambda: NetworkSKL(ftnet) ], data_x, data_y, N=50, samples=800)) stdev = np.mean(results50[:,3])
tdy = [] for didx2 in range(len(data_names)): if didx2 != didx: if data_x[didx2].shape[0] >= 120: tdx.append(data_x[didx2]) tdy.append(data_y[didx2]) ecol = 0 for i in range(500): err = trainingStep(net, 100, 20, tdx, tdy) ecol = ecol + err if i % 10 == 9: methods = [lambda: MAMLSKL(net)] results1 = compareMethodsOnSet(methods, echocardio['x'], echocardio['y'].astype(np.int32), samples=20) auc1 = results1[0][1] results2 = compareMethodsOnSet(methods, bloodtransfusion['x'], bloodtransfusion['y'].astype( np.int32), samples=20) auc2 = results2[0][1] results3 = compareMethodsOnSet(methods, autism['x'], autism['y'].astype(np.int32), samples=20) auc3 = results3[0][1] f = open("finetuning-%s.txt" % data_names[didx], "a")
mamlnet.load_state_dict(torch.load("maml-%s.pth" % file[5:-4])) methods = [lambda: MAMLSKL(mamlnet)] data = np.load(file) print(file) data_x = data['x'].astype(np.float32) data_y = data['y'].astype(np.int32) if np.unique(data_y).shape[0] <= 16: f = open("results/auctable_maml_ft.tex", "a") f.write("\\multirow{3}{*}{%s} " % (dataset_descriptions[file])) if data_x.shape[0] >= 20: f.write("& 10 ") results10 = np.array( compareMethodsOnSet(methods, data_x, data_y, N=10, samples=800)) stdev = np.mean(results10[:, 3]) maxval = np.max(results10[:, 1]) f.write("& %.3g " % stdev) for i in range(results10.shape[0]): if abs(maxval - results10[i, 1]) < stdev: f.write("& \\bf{%.3g} " % (results10[i, 1])) else: f.write("& %.3g " % (results10[i, 1])) f.write("\\\\ \n") avg10.append(results10) if data_x.shape[0] >= 60: f.write("& 50 ") results50 = np.array( compareMethodsOnSet(methods, data_x, data_y, N=50,