[ML] overall_accuracy is low for an imbalanced classification
- Ngôn ngữ chính
- C++
- Star
- 157
- Fork
- 67
- Merge trung bình
- 17 giờ 52 phút
- Pull request đã merge (30 ngày)
- 20
Mô tả
When using sklean imbalanced dataset (imbalanced ratio 99:1), our DFA job shows poor performance: overall_accuracy is 0.02
Step to reproduce:
On latest master build (Jul 19's)
1. On Data Visualizer, import the `imbalance.csv` file to index: `imbalance`
[imbalance.csv](https://github.com/elastic/ml-cpp/files/6849734/imbalance.csv)
2. During the import, change the mapping of column 30 from double to long:
```
"30": {
"type": "long"
}
```
3. Create and start dfa job from dev console:
```
PUT _ml/data_frame/analytics/imbalance
{
"source": {
"index": [
"imbalance"
],
"query": {
"match_all": {}
}
},
"dest": {
"index": "dest-imbalance",
"results_field": "ml"
},
"analysis": {
"classification" : {
"dependent_variable" : "30",
"class_assignment_objective" : "maximize_minimum_recall",
"num_top_classes" : 2,
"prediction_field_name" : "30_prediction",
"training_percent" : 80.0,
"randomize_seed" : 4642014714383011104,
"early_stopping_enabled" : true
}
},
"model_memory_limit": "1gb",
"allow_lazy_start": false,
"max_num_threads": 1
}
POST _ml/data_frame/analytics/imbalance/_start
```
4. Once job finishes, run the evaluation
```
POST _ml/data_frame/_evaluate
{
"index": "dest-imbalance",
"query": {
"term": {
"ml.is_training": {
"value": "false"
}
}
},
"evaluation": {
"classification": {
"actual_field": "30",
"predicted_field": "ml.30_prediction",
"metrics": {
"accuracy" : {}
}
}
}
}
```
**Result:**
```
{
"classification" : {
"accuracy" : {
"classes" : [
{
"class_name" : "0",
"value" : 0.02
},
{
"class_name" : "1",
"value" : 0.02
}
],
"overall_accuracy" : 0.02
}
}
}
```
Hướng dẫn đóng góp
Hướng nghiên cứu
Tái hiện workflow của imbalance.csv thông qua Data Visualizer, start request của _ml/data_frame/analytics và accuracy request của _ml/data_frame/_evaluate. Sau đó, lần theo đường dẫn đánh giá phân loại cho metric accuracy và so sánh cách xử lý hai lớp; hoàn tất khi quá trình đánh giá báo cáo một overall_accuracy chính xác cho tập dữ liệu mất cân bằng này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- machine-learning
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100