diff options
| author | Kagamino <martin@lehoux.net> | 2019-04-01 16:27:05 +0200 |
|---|---|---|
| committer | Kagamino <martin@lehoux.net> | 2019-04-01 16:27:05 +0200 |
| commit | a1d8ca43ffea7141545525afe93a4cb29ccb0bd4 (patch) | |
| tree | e63c0f8c2d5bf0382aa86136705600b010b74f64 /MultiLayerPerceptron/data.py | |
| parent | 2c0ba9fa615fc567acf03cf21b5dd3c9e598d91a (diff) | |
move
Diffstat (limited to 'MultiLayerPerceptron/data.py')
| -rw-r--r-- | MultiLayerPerceptron/data.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/MultiLayerPerceptron/data.py b/MultiLayerPerceptron/data.py new file mode 100644 index 0000000..ae41bb7 --- /dev/null +++ b/MultiLayerPerceptron/data.py @@ -0,0 +1,18 @@ +import idx2numpy +import numpy as np + +images = list(idx2numpy.convert_from_file('t10k-images-idx3-ubyte')/255) +labels = idx2numpy.convert_from_file('t10k-labels-idx1-ubyte') +new_labels = np.zeros((len(labels), 10)) +new_labels[np.arange(len(labels)), labels] = 1 +# new_labels = [np.zeros(10, dtype=int)]*len(labels) +# for k in range(len(labels)): +# new_labels[k][labels[k]] = 1 +train_set = list(zip(images, new_labels)) +# print(train_set[0]) + +np.save(open('test.npy', 'wb'), train_set) + +# arr = np.load(open('train.npy', 'rb')) + +# print(arr[0])
\ No newline at end of file |
