MCPcopy Create free account
hub / github.com/lazyprogrammer/machine_learning_examples / get_mnist

Function get_mnist

unsupervised_class3/util.py:39–56  ·  view source on GitHub ↗
(limit=None)

Source from the content-addressed store, hash-verified

37
38
39def get_mnist(limit=None):
40 if not os.path.exists('../large_files'):
41 print("You must create a folder called large_files adjacent to the class folder first.")
42 if not os.path.exists('../large_files/train.csv'):
43 print("Looks like you haven't downloaded the data or it's not in the right spot.")
44 print("Please get train.csv from https://www.kaggle.com/c/digit-recognizer")
45 print("and place it in the large_files folder.")
46
47 print("Reading in and transforming data...")
48 df = pd.read_csv('../large_files/train.csv')
49 data = df.values
50 # np.random.shuffle(data)
51 X = data[:, 1:] / 255.0 # data is from 0..255
52 Y = data[:, 0]
53 X, Y = shuffle(X, Y)
54 if limit is not None:
55 X, Y = X[:limit], Y[:limit]
56 return X, Y
57
58
59def get_celeb(limit=None):

Callers 1

perceptron.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected