forked from duguyue100/cs231n-practice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcs231ntest.py
More file actions
36 lines (23 loc) · 713 Bytes
/
cs231ntest.py
File metadata and controls
36 lines (23 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Author : Yuhuang Hu
Date : 2015-01-07
Perform some tests for the written code
"""
import numpy as np;
import matplotlib.pyplot as plt;
from cs231nlib.classifier import NearestNeighbor;
from cs231nlib.utils import load_CIFAR10;
from cs231nlib.utils import visualize_CIFAR;
## load dataset
Xtr, Ytr, Xte, Yte=load_CIFAR10("data/CIFAR10");
print Xtr.shape[0];
print Xtr.shape[1];
print Xtr.shape[2];
print Xtr.shape[3];
## plot configuration
plt.rcParams['figure.figsize']=(10.0, 8.0);
plt.rcParams['image.interpolation'] = 'nearest'
plt.rcParams['image.cmap'] = 'gray'
visualize_CIFAR(X_train=Xtr, y_train=Ytr, samples_per_class=10);
## Testing for Nearest Neighbor Function
nn=NearestNeighbor();