Official research code for Adaptive Mahalanobis Prototype Ratios for Machine-Learning Confidence Estimation.
Repository: https://github.com/pointers1/APGC
APGC is a post-hoc confidence score for probabilistic classifiers. It combines the classifier's probability margin with a bounded geometric ratio computed from adaptive class prototypes in a regularized Mahalanobis space.
- Shallom Danjuma Bitrus - Department of Mathematics, Taraba State University, Jalingo, Nigeria
Email: shallombitrus7@gmail.com - Peter Anthony - Department of Applied Informatics, Comenius University Bratislava, Slovakia
Email: peter.anthony@fmph.uniba.sk - Michael Sunday Olawuni - Ardova Plc, Lagos, Nigeria
Email: olawuni.michael@gmail.com
.
├── scripts/
│ ├── run_experiments.py # datasets, models, APGC and all baselines
│ ├── analyse_results.py # aggregation, bootstrap intervals and tests
│ ├── benchmark_runtime.py # query-time and storage benchmark
│ └── generate_assets.py # figures and LaTeX result tables
├── tests/ # lightweight unit tests
├── docs/METHOD.md # mathematical definition and protocol
├── results/ # generated CSV/JSON outputs
├── figures/ # generated PNG/PDF figures
├── tables/ # generated LaTeX tables
├── requirements.txt
├── environment.yml
├── CITATION.cff
└── LICENSE
The generated outputs under results/, figures/ and tables/ are committed so the reported numbers and plots can be inspected without rerunning the benchmark. They are also fully recreated by the scripts below.
Python 3.10 or newer is recommended.
python -m venv .venv
# Linux/macOS
source .venv/bin/activate
# Windows PowerShell
# .venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -r requirements.txtconda env create -f environment.yml
conda activate apgcRun one dataset and one split:
python scripts/run_experiments.py --output results --datasets Iris --seeds 11or:
make quickThis creates the experiment files under results/.
From the repository root:
python scripts/run_experiments.py --output results
python scripts/analyse_results.py
python scripts/benchmark_runtime.py
python scripts/generate_assets.pyEquivalent Make commands:
make full
make analyse
make runtime
make assetsThe full protocol uses 16 classification tasks, four classifiers and five stratified train/validation/test splits. Runtime depends on the machine and available CPU cores.
- Logistic regression:
max_iter=1500 - Histogram-based gradient-boosted decision trees (HistGBDT):
max_iter=150,learning_rate=0.08,max_leaf_nodes=31 - Random forest:
n_estimators=200,min_samples_leaf=2 - Multilayer perceptron: hidden layers
(48, 24),max_iter=250, early stopping, validation fraction0.15
HistGBDT is used as a nonlinear boosted-tree baseline. Its histogram-based split search provides efficient and scalable training while preserving the flexibility of gradient-boosted decision trees. Unlisted parameters retain their scikit-learn defaults.
results/all_results.csv: per-dataset, split, classifier and method resultsresults/dataset_model_aggregate.csv: seed-averaged statistical unitsresults/method_summary_overall.csv: overall method summaryresults/pairwise_tests.csv: Wilcoxon tests with Holm correctionresults/bootstrap_cis.csv: paired bootstrap confidence intervalsresults/statistics.json: benchmark-level statisticsfigures/: publication-ready result plotstables/: generated LaTeX tables
- APGC
- Adaptive prototype geometry
- Single Mahalanobis centroid
- Euclidean centroid
- Class-wise 1-nearest-neighbour distance ratio
- Probability margin
- Maximum probability
- Negative entropy
python -m pip install -r requirements-dev.txt
pytest -q- Scaling, covariance estimation, prototype fitting and hyperparameter selection use only the training and validation data.
- Test labels are used only for final evaluation.
- The selected prototype count is from
{1, 2, 3, 5}. - The APGC mixture weight is selected from 21 equally spaced values in
[0,1]. - Random seeds are fixed in the scripts.
- Some tasks are explicitly labelled
derived-real; they should not be described as independently collected datasets.
The repository contains CITATION.cff. Add the paper DOI or proceedings information to CITATION.cff when it becomes available.
MIT License. See LICENSE.