| 37 | |
| 38 | |
| 39 | def 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 | |
| 59 | def get_celeb(limit=None): |