파이썬
파이썬 ImportError: No module named model_selection
º기록
2020. 10. 26. 12:18
반응형
train_test_split 함수를 사용하고 다음과 같이 작성하려고합니다.
from sklearn.model_selection import train_test_split
그리고 이것은
ImportError: No module named model_selection
왜? 그리고 극복하는 방법?
해결 방법
from sklearn.cross_validation import train_test_split
그러나 이제는 model_selection 모듈에 있습니다.
from sklearn.model_selection import train_test_split
따라서 최신 버전이 필요합니다.
버전 0.18 이상으로 업그레이드하려면 다음을 수행하십시오.
pip install -U scikit-learn
(또는 Python 버전에 따라 pip3 ). 다른 방법으로 설치했다면, 예를 들어 Anaconda를 사용할 때 다른 방법으로 업데이트해야합니다.
참조 페이지 https://stackoverflow.com/questions/40704484
반응형