https://horangcat.tistory.com/14
220117) Iris data로 Random Forest 실습
* load_iris 데이터셋 - petal length, petal width, sepal length, sepal width에 따라 세 종류로 나눌 수 있다. 데이터 로드 from sklearn.datasets import load_iris load_iris() # 붓꽃 데이터 리턴 - dict i..
horangcat.tistory.com
여기에서 이어집니다.
from sklearn.metrics import accuracy_score
print('정확도:', accuracy_score(y_test, prediction1))
>> 정확도: 0.9333333333333333
from sklearn.metrics import confusion_matrix confusion_matrix(y_test, prediction1)
>> array([[11, 0, 0],
[ 0, 12, 0],
[ 0, 2, 5]])
정확도, 정밀도, F1 score 계산하기
정밀도(Precision)란? 예측이 얼마나 정확한가
재현율(Recall)이란? 실제 정답을 얼마나 맞췄는가

- classification_report : 정밀도, 재현율, f1-score 다 계산해준다.
from sklearn.metrics import classification_report print(classification_report(y_test, prediction1))

- feature_importances_ : 컬럼 중요도 계산할 수 있다.

* 추가로,, 알게된 것 정리
https://horangcat.tistory.com/15
Random Forest Classifier, 전에 몰랐던 것들
https://wyatt37.tistory.com/9 지니(Gini) vs 엔트로피(Entropy) 그리고 정보 이득량(Information Gain) 안녕하세요, 끙정입니다. 오늘은 Tree Based Method에서 파티션(노드)을 분할할 때 기준으로 쓰이는 두 가..
horangcat.tistory.com
* 성능평가 개념 다시 정리할것,, (파이썬 머신러닝 완벽 가이드)
https://velog.io/@ljs7463/%EB%A8%B8%EC%8B%A0%EB%9F%AC%EB%8B%9D-%EB%AA%A8%EB%8D%B8-%ED%8F%89%EA%B0%80%EC%A0%95%EB%B0%80%EB%8F%84%EC%9E%AC%ED%98%84%EC%9C%A8f1-score%EB%93%B1
머신러닝 분류모델 평가(정밀도,재현율,f1-score등)
평가란...?? 머신러닝의 프로세스를 간단하게 살펴 보면 데이터 가공/변환, 모델 학습/예측, 그리고 평가(Evaluation)으로 구성이된다. 어떻게 데이터를 가공하고 변환시켜서 이것을 모델에 넣어 학
velog.io
'Data Science' 카테고리의 다른 글
220120) 혼동행렬(Confusion Matrix) & ROC AUC Score (0) | 2022.01.20 |
---|---|
220119) breast cancer data로 xgboost 실습 (0) | 2022.01.19 |
Random Forest Classifier, 전에 몰랐던 것들 (0) | 2022.01.18 |
220117) Iris data로 Random Forest 실습 (0) | 2022.01.17 |
code) play tennis data로 Decision Tree Classifier 적용해보기, 트리 시각화, train_test_split 후 성능평가까지 (0) | 2022.01.16 |