def train(self, shared=True): ucifolder = UCIFolder(self.D, normalize=False, shuffle=False) self.X_train, self.Y_train = [], [] self.X_test, self.Y_test, self.P = [], [], [] for c in [80]:#[5,10,15,20,30,50,80]: # Get data and labels at fold k X,Y = ucifolder.training(c) print X.shape, Y.shape # Get the testing data Xi,Yi = ucifolder.testing(c) # Solve for the vector of linear factors, W return self.boost(X, Y, Xi, Yi, self.thresh(X))
def train(self, shared=True): ucifolder = UCIFolder(self.D, normalize=False, shuffle=True) self.X_train, self.Y_train = [], [] self.X_test, self.Y_test, self.P = [], [], [] for c in [5,10,15,20,30,50,80]: # Get data and labels at fold k X,Y = ucifolder.training(c) # Get the testing data Xi,Yi = ucifolder.testing(c) # Solve for the vector of linear factors, W train_error, test_error, test_auc = self.boost(X, Y, Xi, Yi, self.thresh(X)) print "c%="+str(c)+"%, train error:", "%.2f" % train_error, print "test error:", "%.2f" % test_error, "AUC:", "%.2f" % test_auc
def train(self, shared=True): ucifolder = UCIFolder(self.D, normalize=False, shuffle=False) n = len(self.D) / 50 t = len(self.D) / 2 for c in [5]: # [5,10,15,20,30,50]: # Get the active learning pool px, py = ucifolder.training(c, pool=True) # Get data and labels at fold k X, Y = ucifolder.training(c) # Get the testing data Xi, Yi = ucifolder.testing(c) # Do active learning while len(X) < t: print "Training pool size:", float(len(X)) / float(len(self.D)) classifier = self.boost(X, Y, Xi, Yi, self.thresh(X)) X, Y, px, py = self.add(X, Y, px, py, classifier, n)