前提・実現したいこと
Google Colaboratory上で『ゼロから作るDeeplearning②―自然言語処理編』を実装しようとしています。
Webサイト(https://stillalive0304.hatenablog.com/entry/2018/07/30/153753#%E6%BA%96%E5%82%99--%E7%84%A1%E6%96%99GPU%E3%81%AEgoogle-colab%E4%B8%8A%E3%81%A7%E5%AE%9F%E8%A1%8C%E3%81%99%E3%82%8B)を参考に、
①https://github.com/oreilly-japan/deep-learning-from-scratch-2からコード一式をダウンロードし、Google Drive上にそのまま一式アップロードした
②Google ColaboratoryでGoogle Driveをマウントした(マウント自体は多分できた?)
③https://github.com/oreilly-japan/deep-learning-from-scratch-2/blob/master/ch02/ppmi.pyのコードを実行しようとしたら、
以下のエラーメッセージが発生しました。
基本的な質問かもしれませんが、どうぞよろしくお願いいたします。
発生している問題・エラーメッセージ
ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-c109aa03a037> in <module>() 2 sys.path.append('content/drive/deep-learning-from-scratch-2-master') 3 import numpy as np ----> 4 from common.util import preprocess, create_co_matrix, cos_similarity, ppmi 5 6 ModuleNotFoundError: No module named 'common' --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below.
該当のソースコード
# coding: utf-8 import sys sys.path.append('content/drive/deep-learning-from-scratch-2-master') import numpy as np from common.util import preprocess, create_co_matrix, cos_similarity, ppmi text = 'You say goodbye and I say hello.' corpus, word_to_id, id_to_word = preprocess(text) vocab_size = len(word_to_id) C = create_co_matrix(corpus, vocab_size) W = ppmi(C) np.set_printoptions(precision=3) # 有効桁3桁で表示 print('covariance matrix') print(C) print('-'*50) print('PPMI') print(W)
試したこと
sys.path.append以下の('content/drive/deep-learning-from-scratch-2-master')の中身を変えたりして試行錯誤しましたが、
うまくいきません。
補足情報(FW/ツールのバージョンなど)
Pythonのバージョン:2.7
OS:Windows 10
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/24 05:44
2018/09/24 06:02
2018/09/24 06:22
2018/09/24 06:43
2018/09/27 09:52