ERRORの原因がわかりません。
解決するにはどうしたらいいのでしょうか?
-------------------------------------------------------------------------- FileNotFoundError Traceback (most recent call last) <ipython-input-8-e8450d16cb94> in <module>() 30 31 x, t = get_date() ---> 32 network = init_network() 33 34 accuracy_cnt = 0 <ipython-input-8-e8450d16cb94> in init_network() 11 12 def init_network(): ---> 13 with open (r"C:\cs\ch03" "rb") as f: 14 network = pickle.load(f) 15 return network FileNotFoundError: [Errno 2] No such file or directory: 'C:\cs\ch03rb'
該当のソースコード
python
1import sys , os 2sys.path.append(os.pardir) 3os.chdir(r"C:\cs\dataset") 4from dataset.mnist import load_mnist 5(x_train, t_train),(x_test,t_test) = load_mnist(flatten=True,normalize=False) 6 7 8def get_date(): 9 (x_train, t_train),(x_test,t_test)= load_mnist(flatten=True,normalize=False) 10 return x_test, t_test 11 12def init_network(): 13 with open (r"C:\cs\ch03" "rb") as f: 14 network = pickle.load(f) 15 return network 16 17def predict(network, x): 18 W1,W2,W3 = network['W1'], network['W2'], network['W3'] 19 b1,b2,b3 = network['b1'], network['b2'], network['b3'] 20 21 a1 = np.dot(x, W1) + b1 22 z1 = sigmoig(a1) 23 a2 = np.dot(z1, W2) + b2 24 z2 = sigmoig(a2) 25 a3 = np.dot(z2, W3) + b3 26 y = sigmoig(a3) 27 28 return y 29 30 31x, t = get_date() 32network = init_network() 33 34accuracy_cnt = 0 35for i in range(len(x)): 36 y = pridict(network, x[i]) 37 p = np.argmax(y) 38 if p == t[i]: 39 accuracy_cnt += 1 40 41print("accuracy" + str(float(accuracy_cnt / len(x)))) 42 43
試したこと
https://github.com/oreilly-japan/deep-learning-from-scratchから再ダウンロードと再起動を何回かしました
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/29 02:24