Python機械学習プログラミング 達人データサイエンティストによる理論と実践 に関する質問
1.質問内容
上記参考書のP343~345について質問です。
mnistデータを読み込むプログラムです。
以下のようにプログラミングを書きましたがエラーが出てしまいます
import os import struct import numpy as np def load_mnist(path, kind='train'): """Load MNIST data from `path`""" labels_path = os.path.join(path, '%s-labels-idx1-ubyte' % kind) images_path = os.path.join(path, '%s-images-idx3-ubyte' % kind) with open(labels_path, 'rb') as lbpath: magic, n = struct.unpack('>II', lbpath.read(8)) labels = np.fromfile(lbpath, dtype=np.uint8) with open(images_path, 'rb') as imgpath: magic, num, rows, cols = struct.unpack(">IIII", imgpath.read(16)) images = np.fromfile(imgpath, dtype=np.uint8).reshape(len(labels), 784) images = ((images / 255.) - .5) * 2 return images, labels
>>>X_train, y_train = load_mnist('', kind='train') print('Rows: %d, columns: %d' % (X_train.shape[0], X_train.shape[1]))
エラー内容はこうです。
Traceback (most recent call last):
File "<ipython-input-19-bb02ebde76e9>", line 1, in <module>
X_train, y_train = load_mnist('', kind='train')
File "C:\達人データサイエンティスト\タイトル無し9.py", line 19, in load_mnist
PermissionError: [Errno 13] Permission denied: 'train-labels-idx1-ubyte'
