p = np.concatenate([ np.repeat(p_common_examples, n_common_examples), np.repeat(p_subset_examples, n_subset_examples), ], axis=0) perm = np.random.choice(indices, perm_length, replace=self._sample_with_replacement, p=p) return perm_list if __name__ == '__main__': ilogger.setup_root_logger('/dev/null', logging.DEBUG) minibatch_size = 1 learning_rate = 0.01 n_iterations = 100 mnist = input_data.read_data_sets("MNIST_data/", one_hot=True) mnist_classifier = MNISTConvNet(minibatch_size, learning_rate, n_iterations, mnist.train, model_name='UnifiedClassifier', write_summary=False) mnist_classifier.test_data = mnist.test mnist_classifier.train_model() accuracy = mnist_classifier.evaluate_model(mnist.test)
#!/usr/bin/python3 import scipy.io as sio import numpy as np import pickle import logging import pdb from concurrent.futures import ProcessPoolExecutor import input_data import sys import ilogger import time ilogger.setup_root_logger('/dev/null', logging.ERROR) class Metrics(object): def __init__(self, name): self.name = name def __getstate__(self): state = self.__dict__.copy() return state def __setstate__(self, state): self.__dict__.update(state) def l2_error(weight1, weight2): return np.linalg.norm(weight1 - weight2)