AI·빅데이터 융합 경영학 Study Note
NoneType' object has no attribute 'split' 본문
# 각 모델별 prediction 저장 및 성능(Accuracy) 확인
pred_results = []
for clf in clfs :
pred = clf.fit(X_train, y_train).predict(X_test)
name = type(clf).__name__
pred_results.append(pd.Series(pred, name=name))
print("{:30s} {}".format(name, accuracy_score(y_test, pred)))
또는
from sklearn.ensemble import VotingClassifier
# 위에서 평가한 모든 모델을 앙상블할 경우
voting = VotingClassifier(estimators = [(type(clf).__name__, clf) for clf in clfs], voting='hard')
voting.fit(X_train, y_train).score(X_test, y_test)
오류코드
NoneType' object has no attribute 'split'
scikit-learn,cluster KMeans 'Nonetype' object has no attribute 'split' 오류
scikit-learn이 버전 업그레이드 되면서 군집화 모듈 KMeans를 fit()할 때 오류가 발생한다.scikit-learn을 설치하면 threadpoolctl 모듈도 함께 설치가 되는데 버전으로 인해 호환성에 문제가 생기는 것이다.t
velog.io
pip install threadpoolctl==3.1.0
import threadpoolctl
print('threadpoolctl Version :', threadpoolctl.__version__)
이걸 명령프롬프트가 아니라 vs코드에 입력해야 하더라. 그러고 재부팅, 모두실행하면 됨.
'기타 > 오류 해결' 카테고리의 다른 글
unindent does not match any outer indentation level (1) | 2023.11.22 |
---|---|
'utf-8' codec can't decode byte 0xe0 in position 39: invalid continuation byte (0) | 2023.11.21 |
No module named 'kerastuner' (0) | 2023.11.21 |
name 'CatBoostClassifier' is not defined (1) | 2023.11.19 |
'utf-8' codec can't decode byte 0xc1 in position 0: invalid start byte (0) | 2023.11.16 |