Esempio n. 1
0
def conditional_mnist(c):
    N_data, train_images, train_labels, test_images, test_labels = load_mnist()
    indices = (train_labels[:, c] == 1)
    c_mean, c_cov = mean_and_cov(train_images[indices, :])
    c_model = c_mean, c_cov
    with open('c_model.pkl', 'w') as f:
        pickle.dump(c_model, f, 1)
Esempio n. 2
0
def model_mnist():
    # Load and process MNIST data
    N_data, train_images, train_labels, test_images, test_labels = load_mnist()
    trained_weights, predict_fun,likeFunc = train_nn(train_images, train_labels, test_images, test_labels)
    all_mean, all_cov = mean_and_cov(train_images)
    mnist_models = trained_weights, all_mean, all_cov
    with open('mnist_models.pkl', 'w') as f:
        pickle.dump(mnist_models, f, 1)