else: return self.j if __name__=="__main__": # Argparse parser = argparse.ArgumentParser() parser.add_argument('-m', help='ECOC or VOTE') args = parser.parse_args(sys.argv[1:]) # Load data using specialized script train_dataset = load_mnist(path="../data/mnist/", dataset="training") test_dataset = load_mnist(path="../data/mnist/", dataset="testing") # Take a fraction of the data to speed computation train_images, train_labels = sample(train_dataset, 5000) test_images, test_labels = sample(test_dataset, 100) # Get the bounds of the haar rectangles bounds = genbounds(28, 28, 100) # Create data, using same rectangles for training and testing train_data = genfeatures(train_images, bounds).astype(float) test_data = genfeatures(test_images, bounds).astype(float) # Normalize the data zmscaler = preprocessing.StandardScaler() train_data = zmscaler.fit_transform(train_data) test_data = zmscaler.transform(test_data) if args.m == 'ECOC':
else: return self.j if __name__=="__main__": # Argparse parser = argparse.ArgumentParser() parser.add_argument('-m', help='ECOC or VOTE') args = parser.parse_args(sys.argv[1:]) # Load data using specialized script train_dataset = load_mnist(path="../data/mnist/", dataset="training") test_dataset = load_mnist(path="../data/mnist/", dataset="testing") # Take a fraction of the data to speed computation train_images, train_labels = sample(train_dataset, 1000) test_images, test_labels = test_dataset # Get the bounds of the haar rectangles bounds = genbounds(28, 28, 100) # Create data, using same rectangles for training and testing train_data = genfeatures(train_images, bounds) #test_data = genfeatures(test_images, bounds) # Normalize the data zmscaler = preprocessing.StandardScaler() train_data = zmscaler.fit_transform(train_data) #test_data = zmscaler.transform(test_data) if args.m == 'ECOC':