Skip to content

Commit 5a6e7c2

Browse files
authored
Add files via upload
week 1 and 2 uploaded
1 parent 75ef197 commit 5a6e7c2

File tree

14 files changed

+8496
-0
lines changed

14 files changed

+8496
-0
lines changed

MLiP-week01and02/1-Introduction.ipynb

Lines changed: 8465 additions & 0 deletions
Large diffs are not rendered by default.

MLiP-week01and02/imgs/Bell-Curve.png

18.3 KB
Loading

MLiP-week01and02/imgs/arrays.png

6.6 KB
Loading
13 KB
Loading

MLiP-week01and02/imgs/cat-matrix.png

267 KB
Loading

MLiP-week01and02/imgs/cifar10.png

733 KB
Loading

MLiP-week01and02/imgs/img2 (1).png

15.7 KB
Loading

MLiP-week01and02/imgs/img2.png

15.7 KB
Loading
26.8 KB
Loading

MLiP-week01and02/imgs/subplot.jpg

87.6 KB
Loading

MLiP-week01and02/my_array.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2.047870966287423933e-02,4.652803246244485713e-01,1.418044583981390439e-01
2+
1.575936388704680668e-01,1.492402393141355477e-01,5.979355554978926790e-01

MLiP-week01and02/my_array.npy

128 Bytes
Binary file not shown.

MLiP-week01and02/utils/data_utils.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import cPickle as pickle
2+
import numpy as np
3+
import os
4+
from scipy.misc import imread
5+
6+
def load_CIFAR_batch(filename):
7+
""" load single batch of cifar """
8+
with open(filename, 'rb') as f:
9+
datadict = pickle.load(f)
10+
X = datadict['data']
11+
Y = datadict['labels']
12+
X = X.reshape(10000, 3, 32, 32).transpose(0,2,3,1).astype("float")
13+
Y = np.array(Y)
14+
return X, Y
15+
16+
def load_CIFAR10(ROOT):
17+
""" load all of cifar """
18+
xs = []
19+
ys = []
20+
for b in range(1,6):
21+
f = os.path.join(ROOT, 'data_batch_%d' % (b, ))
22+
X, Y = load_CIFAR_batch(f)
23+
xs.append(X)
24+
ys.append(Y)
25+
Xtr = np.concatenate(xs)
26+
Ytr = np.concatenate(ys)
27+
del X, Y
28+
Xte, Yte = load_CIFAR_batch(os.path.join(ROOT, 'test_batch'))
29+
return Xtr, Ytr, Xte, Yte

MLiP-week01and02/x2.png

13.2 KB
Loading

0 commit comments

Comments
 (0)