1. 실제 데이터를 대상으로 모델을 돌렸놓고 퇴근했다. ( XGB, GBM )
2. 여전히 나의 H2O에 대한 불만은 Custom Loss Function 을 지원하지 않는다는 것이다.
3. 대신, 차선책으로 앙상블을 하는건 어떨까 싶다.
- ㄱ. AUC를 Validation Metric 기준으로 선택한 Hyp Params 로 학습한 XGB 모델 & Recall을 기준으로 선택한 Hyp Params 로 학습한 XGB 모델 2개를 7:3 혹은 5:5 정도로 Blending 한 모델.
- ㄴ. 그런 의미에서 H2O 에서 Recall 을 Valid Metric 으로 세팅 가능한지 찾아보자.
ref - 1 : https://docs.h2o.ai/h2o/latest-stable/h2o-docs/performance-and-prediction.html
Performance and Prediction — H2O 3.32.1.5 documentation
Docs » Performance and Prediction Edit on GitHub Performance and Prediction Model Performance Given a trained H2O model, the h2o.performance() (R)/model_performance() (Python) function computes a model’s performance on a given dataset. Notes: If the pro
docs.h2o.ai
빨간색 박스가 생소한 개념이다.
차례대로
Absolute MCC (Matthews Correlation Coefficient)
Setting the absolute_mcc parameter sets the threshold for the model’s confusion matrix to a value that generates the highest Matthews Correlation Coefficient.
The MCC score provides a measure of how well a binary classifier detects true and false positives, and true and false negatives.
The MCC is called a correlation coefficient because it indicates how correlated the actual and predicted values are; 1 indicates a perfect classifier, -1 indicates a classifier that predicts the opposite class from the actual value, and 0 means the classifier does no better than random guessing.
걍 Confusion Matrix 를 각각 4개 영역을 잘 맞추는지 검증하는 수치라고 이해하면 되려나?
- Confusion Matrix 개념에서 자주 헷갈리는데, 이렇게 기억하자.
False Pos. -> ( 미국인들은 거꾸로 읽으니까 ?! ) Positive 라고 잘못 예측(False)했다. -> 실제 0을 1로 예측했다.
False Neg. -> Neg 라고 잘못 예측했다. -> 실제 1을 0로 예측했다.
Fraud Detection 에선 F2 를 쓰는게 더 적절해 보인다. 실제 1을 0으로 예측하면 안되니까 !
F2 ( F0.5 랑은 반대 개념이니까, F0.5는 생략 )
The F2 score is the weighted harmonic mean of the precision and recall (given a threshold value). Unlike the F1 score, which gives equal weight to precision and recall, the F2 score gives more weight to recall (penalizing the model more for false negatives then false positives). An F2 score ranges from 0 to 1, with 1 being a perfect model.
False Neg 를 더 큰 페널티 -> 실제 1을 0으로 잘못 예측하는걸 더 큰 패널티.
AUCPR (Area Under the Precision-Recall Curve)
This model metric is used to evaluate how well a binary classification model is able to distinguish between precision recall pairs or points. These values are obtained using different thresholds on a probabilistic or other continuous-output classifier. AUCPR is an average of the precision-recall weighted by the probability of a given threshold.
The main difference between AUC and AUCPR is that AUC calculates the area under the ROC curve and AUCPR calculates the area under the Precision Recall curve. The Precision Recall curve does not care about True Negatives. For imbalanced data, a large quantity of True Negatives usually overshadows the effects of changes in other metrics like False Positives. The AUCPR will be much more sensitive to True Positives, False Positives, and False Negatives than AUC. As such, AUCPR is recommended over AUC for highly imbalanced data.
오호.. 새롭게 안 사실이다.
PR curve 는 True Neg 를 무시하는데,
클래스간 불균형이 심한 데이터에선 True Neg 케이스가 아주 많아서 무시할 필요가 있다.
따라서 AUCPR 는 대신 True Positive, False Pos/Neg 에 민감하다.
그래서 클래스간 불균형이 심할때 추천한다고 한다.
그러나 ,,, 본질적으로 loss function을 건드려보고 싶으나,,,,
우연히, 로또와 같은 기적으로, evaluate metric 을 클래스간 불균형이 심할때 쓰는 metric으로 정해놓고, 해당 metric이 가장 좋게 나온 하이퍼 파라미터가 나오고, 해당 하이퍼 파라미터로 재학습했을때, 실제 스코어가 좋게 나온길 바라야 할 것 같다.
ref - 2 : https://docs.h2o.ai/h2o/latest-stable/h2o-py/docs/metrics.html
Metrics in H2O — H2O documentation
© Copyright 2015-2021 H2O.ai. Last updated on Aug 04, 2021.
docs.h2o.ai