Merge pull request #48 from CSTR-Edinburgh/mlp2017-8/lab1

Mlp2017 8/lab1
This commit is contained in:
AntreasAntoniou 2017-09-22 21:01:52 +01:00 committed by GitHub
commit d74ea9be7b
11 changed files with 79 additions and 33 deletions

BIN
data/mnist-test.npz Normal file

Binary file not shown.

BIN
data/mnist-train.npz Normal file

Binary file not shown.

BIN
data/mnist-valid.npz Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -47,7 +47,7 @@ bash Miniconda3-latest-Linux-x86_64.sh
You will first be asked to review the software license agreement. Assuming you choose to agree, you will then be asked
to choose an install location for Miniconda. The default is to install in the root of your home directory
`~/miniconda2`. We recommend going with this default unless you have a particular reason to do otherwise.
`~/miniconda3`. We recommend going with this default unless you have a particular reason to do otherwise.
You will then be asked whether to prepend the Miniconda binaries directory to the `PATH` system environment variable
definition in `.bashrc`. As the DICE bash start-up mechanism differs from the standard set up
@ -355,7 +355,7 @@ Run the install script:
bash Miniconda3-latest-Linux-x86_64.sh
```
Review the software license agreement and choose whether to accept. Assuming you accept, you be asked to choose an install location for Miniconda. The default is to install in the root of your home directory `~/miniconda2`. We will assume below you have used this default. **If you use a different path you will need to adjust the paths in the commands below to suit.**
Review the software license agreement and choose whether to accept. Assuming you accept, you be asked to choose an install location for Miniconda. The default is to install in the root of your home directory `~/miniconda3`. We will assume below you have used this default. **If you use a different path you will need to adjust the paths in the commands below to suit.**
You will then be asked whether to prepend the Miniconda binaries directory to the `PATH` system environment variable definition in `.bashrc`. You should respond `no` here as we will set up the addition to `PATH` manually in the next step.

View File

@ -5,7 +5,7 @@ This module provides classes for loading datasets and iterating over batches of
data points.
"""
import cPickle
import pickle
import gzip
import numpy as np
import os
@ -121,22 +121,25 @@ class MNISTDataProvider(DataProvider):
# separator for the current platform / OS is used
# MLP_DATA_DIR environment variable should point to the data directory
data_path = os.path.join(
os.environ['MLP_DATA_DIR'], 'mnist_{0}.pkl.gz'.format(which_set))
os.environ['MLP_DATA_DIR'], 'mnist-{0}.npz'.format(which_set))
assert os.path.isfile(data_path), (
'Data file does not exist at expected path: ' + data_path
)
# use a context-manager to ensure the files are properly closed after
# we are finished with them
with gzip.open(data_path) as f:
inputs, targets = cPickle.load(f)
# load data from compressed numpy file
loaded = np.load(data_path)
inputs, targets = loaded['inputs'], loaded['targets']
inputs = inputs.astype(np.float32)
# pass the loaded data to the parent class __init__
super(MNISTDataProvider, self).__init__(
inputs, targets, batch_size, max_num_batches, shuffle_order, rng)
#def next(self):
# """Returns next data batch or raises `StopIteration` if at end."""
# inputs_batch, targets_batch = super(MNISTDataProvider, self).next()
# return inputs_batch, self.to_one_of_k(targets_batch)
def next(self):
"""Returns next data batch or raises `StopIteration` if at end."""
inputs_batch, targets_batch = super(MNISTDataProvider, self).next()
return inputs_batch, self.to_one_of_k(targets_batch)
def __next__(self):
return self.next()
def to_one_of_k(self, int_targets):
"""Converts integer coded class target to 1 of K coded targets.

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
# Exceeded quota problems on DICE
Apologies to those who had issues with having insufficient quota space on DICE in the labs on Monday (25th September).
Apologies to those who may have issues with having insufficient quota space on DICE in the labs on Monday (25th September).
This was caused by the [dynamic AFS quota system](http://computing.help.inf.ed.ac.uk/dynamic-afs-quotas) which only initially allocates users a subset of their maximum quota and then checks hourly to increase this quota as needed. Unfortunately the amount of disk space needed to store the temporary files used in installing the course dependencies exceeded the current dynamic quota for some people. This meant when running the `conda install ...` command it exited with a quota exceeded error.

View File

@ -4,7 +4,7 @@ from setuptools import setup
setup(
name = "mlp",
author = "Pawel Swietojanski, Steve Renals and Matt Graham",
author = "Pawel Swietojanski, Steve Renals, Matt Graham and Antreas Antoniou",
description = ("Neural network framework for University of Edinburgh "
"School of Informatics Machine Learning Practical course."),
url = "https://github.com/CSTR-Edinburgh/mlpractical",