autogluon / autogluon/tabarena
[Meta] Try switching to geometric mean for portfolio building
- Dominant language
- Python
- Stars
- 303
- Forks
- 69
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 49
Description
Geometric mean might lead to better portfolios rather than mean when selecting models.
We should also switch to geometric mean for tables/comparisons, as it appears to be notably smoother than mean.
Simple code example:
```python
from scipy.stats import gmean
from tabrepo import EvaluationRepository, Evaluator
context_name = "D244_F3_C1530_200"
repo = EvaluationRepository.from_context(context_name)
metrics = Evaluator(repo).compare_metrics()
metrics["rank"] = metrics.groupby(["dataset", "fold"])["metric_error"].rank()
framework_ranks = metrics.groupby("framework")["rank"].mean().to_frame(name="mean")
framework_ranks["gmean"] = metrics.groupby("framework")["rank"].apply(gmean)
framework_ranks = framework_ranks.sort_values(by="gmean")
print(framework_ranks.to_markdown())
```
Out:
```
| framework | gmean | mean |
|:----------------------------------|----------:|---------:|
| AutoGluon_bq_24h8c_2023_11_14 | 72.507 | 243.049 |
| AutoGluon_bq_4h8c_2023_11_14 | 74.0987 | 244.004 |
| AutoGluon_bq_1h8c_2023_11_14 | 79.5762 | 242.356 |
| AutoGluon_bq_30m8c_2023_11_14 | 83.8939 | 243.458 |
| AutoGluon_bq_10m8c_2023_11_14 | 91.2031 | 240.518 |
| AutoGluon_bq_5m8c_2023_11_14 | 94.6865 | 247.836 |
| AutoGluon_hq_4h8c_2023_11_14 | 108.438 | 331.773 |
| AutoGluon_hq_1h8c_2023_11_14 | 108.776 | 327.936 |
| autosklearn2_4h8c_2023_11_14 | 115.281 | 284.753 |
| flaml_4h8c_2023_11_14 | 127.287 | 375.793 |
| autosklearn2_1h8c_2023_11_14 | 128.594 | 300.908 |
| lightautoml_4h8c_2023_11_14 | 138.77 | 291.177 |
| autosklearn_4h8c_2023_11_14 | 142.203 | 388.576 |
| flaml_1h8c_2023_11_14 | 146.771 | 401.338 |
| H2OAutoML_4h8c_2023_11_14 | 147.974 | 393.121 |
| lightautoml_1h8c_2023_11_14 | 150.549 | 297.53 |
| H2OAutoML_1h8c_2023_11_14 | 168.128 | 379.074 |
| autosklearn_1h8c_2023_11_14 | 175.074 | 426.012 |
| AutoGluon_mq_4h8c_2023_11_14 | 181.353 | 362.018 |
| AutoGluon_mq_1h8c_2023_11_14 | 184.267 | 364.015 |
| CatBoost_r16_BAG_L1 | 268.185 | 388.68 |
```
Contributor guide
Research direction
Start with the scipy.stats.gmean example and trace EvaluationRepository.from_context and Evaluator(repo).compare_metrics to find how portfolio selection and comparison tables currently aggregate ranks. Confirm the intended scope and acceptance criteria with maintainers, then verify that both portfolio building and table comparisons use the agreed aggregation and reproduce the example output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100