テストを実行した後、このエラーが発生します。これは非常にイライラします。
ImportError Traceback (most recent call last)
<ipython-input-3-3cd21e54f349> in <module>()
81 from tensorflow.keras.models import Sequential
82 from sklearn import preprocessing
---> 83 from sklearn.feature_selection import train_test_split
84
85
ImportError: cannot import name 'train_test_split'
------------------------
------------------------
---
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.
tensorflow2.0 の質問ではありません。無関係なタグ (削除されました) をスパム送信しないでください。
– 砂漠の飛行士
2020 年 9 月 3 日 16:32
急いで開く前にここでの質問は、最初に関連ドキュメントを確認していることを前提としています。そうしていれば、train_test_split が sklearn.feature_selection モジュールではなく、sklearn.model_selection モジュールの下にあることがわかったはずです。
– 砂漠の飛行士
2020 年 9 月 3 日 16:34
それで??代わりに from sklearn.model_selection import train_test_split を試しましたか?
– 砂漠の飛行士
2020 年 9 月 3 日 17:37
------------------------
sklearn のインストールに pip を使用していないようです。ターミナルで次を実行する必要があります:
pip install scikit-learn
そしてエラーなしで実行されることを確認してください。
1
sklearn インポート前処理の前の行は正常に実行されるため、そうではないことに注意してください。
– 砂漠の飛行士
2020 年 9 月 3 日 17:11