metric-diff 0.1.0a1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metric_diff-0.1.0a1/.github/ISSUE_TEMPLATE/bug_report.yml +30 -0
- metric_diff-0.1.0a1/.github/ISSUE_TEMPLATE/config.yml +8 -0
- metric_diff-0.1.0a1/.github/ISSUE_TEMPLATE/feature_request.yml +22 -0
- metric_diff-0.1.0a1/.github/ISSUE_TEMPLATE/new_edge_case.yml +24 -0
- metric_diff-0.1.0a1/.github/ISSUE_TEMPLATE/unexplained_mismatch.yml +37 -0
- metric_diff-0.1.0a1/.github/pull_request_template.md +10 -0
- metric_diff-0.1.0a1/.github/workflows/release.yml +42 -0
- metric_diff-0.1.0a1/.github/workflows/tests.yml +69 -0
- metric_diff-0.1.0a1/.gitignore +8 -0
- metric_diff-0.1.0a1/CHANGELOG.md +23 -0
- metric_diff-0.1.0a1/CODE_OF_CONDUCT.md +11 -0
- metric_diff-0.1.0a1/CONTRIBUTING.md +65 -0
- metric_diff-0.1.0a1/LICENSE +21 -0
- metric_diff-0.1.0a1/PKG-INFO +366 -0
- metric_diff-0.1.0a1/README.md +307 -0
- metric_diff-0.1.0a1/SECURITY.md +7 -0
- metric_diff-0.1.0a1/benchmarks/RESULTS.md +51 -0
- metric_diff-0.1.0a1/benchmarks/RESULTS_HF.md +43 -0
- metric_diff-0.1.0a1/benchmarks/download_hf.py +29 -0
- metric_diff-0.1.0a1/benchmarks/hf_data.py +276 -0
- metric_diff-0.1.0a1/benchmarks/real_data.py +171 -0
- metric_diff-0.1.0a1/docs/USER_GUIDE.md +413 -0
- metric_diff-0.1.0a1/pyproject.toml +55 -0
- metric_diff-0.1.0a1/src/metric_diff/__init__.py +11 -0
- metric_diff-0.1.0a1/src/metric_diff/__main__.py +5 -0
- metric_diff-0.1.0a1/src/metric_diff/backends.py +670 -0
- metric_diff-0.1.0a1/src/metric_diff/batched.py +269 -0
- metric_diff-0.1.0a1/src/metric_diff/cases.py +196 -0
- metric_diff-0.1.0a1/src/metric_diff/cli.py +188 -0
- metric_diff-0.1.0a1/src/metric_diff/core.py +313 -0
- metric_diff-0.1.0a1/src/metric_diff/detectors.py +778 -0
- metric_diff-0.1.0a1/src/metric_diff/inputs.py +322 -0
- metric_diff-0.1.0a1/src/metric_diff/matrix.py +285 -0
- metric_diff-0.1.0a1/src/metric_diff/report.py +128 -0
- metric_diff-0.1.0a1/src/metric_diff/segmentation.py +252 -0
- metric_diff-0.1.0a1/tests/conftest.py +5 -0
- metric_diff-0.1.0a1/tests/test_batched.py +117 -0
- metric_diff-0.1.0a1/tests/test_docs.py +34 -0
- metric_diff-0.1.0a1/tests/test_evaluate.py +91 -0
- metric_diff-0.1.0a1/tests/test_inputs_and_cli.py +101 -0
- metric_diff-0.1.0a1/tests/test_keras.py +85 -0
- metric_diff-0.1.0a1/tests/test_known_issues.py +116 -0
- metric_diff-0.1.0a1/tests/test_matrix.py +114 -0
- metric_diff-0.1.0a1/tests/test_real_data.py +67 -0
- metric_diff-0.1.0a1/tests/test_regression.py +102 -0
- metric_diff-0.1.0a1/tests/test_segmentation.py +153 -0
- metric_diff-0.1.0a1/tests/test_settings.py +196 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Bug in metric-diff
|
|
2
|
+
description: metric-diff crashes, rejects valid input, or reports something wrong about itself
|
|
3
|
+
title: "[bug] <short description>"
|
|
4
|
+
labels: ["bug"]
|
|
5
|
+
body:
|
|
6
|
+
- type: textarea
|
|
7
|
+
id: what
|
|
8
|
+
attributes:
|
|
9
|
+
label: What happened
|
|
10
|
+
validations:
|
|
11
|
+
required: true
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: repro
|
|
14
|
+
attributes:
|
|
15
|
+
label: Minimal reproduction
|
|
16
|
+
render: python
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: traceback
|
|
21
|
+
attributes:
|
|
22
|
+
label: Error / traceback
|
|
23
|
+
render: text
|
|
24
|
+
- type: input
|
|
25
|
+
id: versions
|
|
26
|
+
attributes:
|
|
27
|
+
label: Versions
|
|
28
|
+
description: "Output of: python -c \"import metric_diff, sys; print(metric_diff.__version__, sys.version)\" and your OS"
|
|
29
|
+
validations:
|
|
30
|
+
required: true
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Questions and ideas
|
|
4
|
+
url: https://github.com/DadCoder001/metric-diff/discussions
|
|
5
|
+
about: Ask how to use metric-diff, share results, or discuss which metric convention to report.
|
|
6
|
+
- name: User guide
|
|
7
|
+
url: https://github.com/DadCoder001/metric-diff/blob/main/docs/USER_GUIDE.md
|
|
8
|
+
about: Scenarios ("my F1 doesn't match sklearn", "my Dice differs from MONAI") with snippets to run.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Feature request
|
|
2
|
+
description: A new metric, library, setting or workflow
|
|
3
|
+
title: "[feature] <short description>"
|
|
4
|
+
labels: ["enhancement"]
|
|
5
|
+
body:
|
|
6
|
+
- type: textarea
|
|
7
|
+
id: problem
|
|
8
|
+
attributes:
|
|
9
|
+
label: What are you trying to do?
|
|
10
|
+
description: The situation you're in, not just the feature. Which metric and libraries?
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: proposal
|
|
15
|
+
attributes:
|
|
16
|
+
label: What would help?
|
|
17
|
+
- type: checkboxes
|
|
18
|
+
id: contribute
|
|
19
|
+
attributes:
|
|
20
|
+
label: Contributing
|
|
21
|
+
options:
|
|
22
|
+
- label: I'd be willing to help implement this
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: New edge case
|
|
2
|
+
description: A known metric difference between libraries that metric-diff doesn't cover yet
|
|
3
|
+
title: "[edge case] <metric>: <short description>"
|
|
4
|
+
labels: ["edge case"]
|
|
5
|
+
body:
|
|
6
|
+
- type: textarea
|
|
7
|
+
id: description
|
|
8
|
+
attributes:
|
|
9
|
+
label: What differs, and why
|
|
10
|
+
description: The libraries involved, the values they return, and the setting or convention behind it.
|
|
11
|
+
validations:
|
|
12
|
+
required: true
|
|
13
|
+
- type: textarea
|
|
14
|
+
id: repro
|
|
15
|
+
attributes:
|
|
16
|
+
label: Minimal reproduction
|
|
17
|
+
render: python
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: input
|
|
21
|
+
id: upstream
|
|
22
|
+
attributes:
|
|
23
|
+
label: Upstream issue or documentation (if any)
|
|
24
|
+
placeholder: https://github.com/<org>/<repo>/issues/<n>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
name: Unexplained mismatch
|
|
2
|
+
description: metric-diff says "no known cause reproduces agreement", or explains it wrongly
|
|
3
|
+
title: "[mismatch] <metric>: <library> differs from <library>"
|
|
4
|
+
labels: ["mismatch", "triage"]
|
|
5
|
+
body:
|
|
6
|
+
- type: markdown
|
|
7
|
+
attributes:
|
|
8
|
+
value: |
|
|
9
|
+
Thanks! Every confirmed report becomes a new detector and a new case in the conformance matrix.
|
|
10
|
+
Please don't paste private data: a small synthetic example that reproduces the difference is perfect.
|
|
11
|
+
- type: textarea
|
|
12
|
+
id: report
|
|
13
|
+
attributes:
|
|
14
|
+
label: metric-diff report
|
|
15
|
+
description: Output of `metric-diff <metric> --true ... --pred ... --json`, or `print(compare(...).to_dict())`.
|
|
16
|
+
render: json
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: repro
|
|
21
|
+
attributes:
|
|
22
|
+
label: Minimal reproduction
|
|
23
|
+
description: The y_true / y_pred (or a script that builds them) and the call you made.
|
|
24
|
+
render: python
|
|
25
|
+
validations:
|
|
26
|
+
required: true
|
|
27
|
+
- type: textarea
|
|
28
|
+
id: expected
|
|
29
|
+
attributes:
|
|
30
|
+
label: What did you expect?
|
|
31
|
+
description: Which value you think is right, and why (documentation, a paper, another library).
|
|
32
|
+
- type: input
|
|
33
|
+
id: versions
|
|
34
|
+
attributes:
|
|
35
|
+
label: Versions
|
|
36
|
+
description: The report includes library versions; add your Python version and OS.
|
|
37
|
+
placeholder: Python 3.12, Ubuntu 24.04
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## What this changes
|
|
2
|
+
|
|
3
|
+
<!-- One or two sentences. Link the issue: Fixes #123 -->
|
|
4
|
+
|
|
5
|
+
## Checklist
|
|
6
|
+
|
|
7
|
+
- [ ] Tests added or updated (a new detector needs a test that shows the libraries disagree *and* that metric-diff confirms the cause)
|
|
8
|
+
- [ ] New mismatches also added as an edge case in `src/metric_diff/cases.py`, linked to the upstream issue if there is one
|
|
9
|
+
- [ ] `pytest` passes locally
|
|
10
|
+
- [ ] README / user guide updated if behaviour changed
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: release
|
|
2
|
+
|
|
3
|
+
# Publishes to PyPI when a GitHub release is published.
|
|
4
|
+
# One-time setup on PyPI: add a "trusted publisher" for this repository
|
|
5
|
+
# (owner DadCoder001, repository metric-diff, workflow release.yml, environment pypi).
|
|
6
|
+
# No API token is stored anywhere.
|
|
7
|
+
|
|
8
|
+
on:
|
|
9
|
+
release:
|
|
10
|
+
types: [published]
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
- uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
- run: python -m pip install --upgrade pip build
|
|
21
|
+
- run: python -m build
|
|
22
|
+
- name: Check the version matches the release tag
|
|
23
|
+
run: |
|
|
24
|
+
version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
25
|
+
test "v$version" = "${GITHUB_REF_NAME}" || { echo "pyproject version v$version != tag ${GITHUB_REF_NAME}"; exit 1; }
|
|
26
|
+
- uses: actions/upload-artifact@v4
|
|
27
|
+
with:
|
|
28
|
+
name: dist
|
|
29
|
+
path: dist/
|
|
30
|
+
|
|
31
|
+
publish:
|
|
32
|
+
needs: build
|
|
33
|
+
runs-on: ubuntu-latest
|
|
34
|
+
environment: pypi
|
|
35
|
+
permissions:
|
|
36
|
+
id-token: write
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/download-artifact@v4
|
|
39
|
+
with:
|
|
40
|
+
name: dist
|
|
41
|
+
path: dist/
|
|
42
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: tests-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
minimal:
|
|
15
|
+
# pip install metric-diff with no extras: scikit-learn only. Everything must import and run;
|
|
16
|
+
# tests that need the other libraries skip themselves.
|
|
17
|
+
name: minimal / ${{ matrix.os }} / py${{ matrix.python }}
|
|
18
|
+
runs-on: ${{ matrix.os }}
|
|
19
|
+
strategy:
|
|
20
|
+
fail-fast: false
|
|
21
|
+
matrix:
|
|
22
|
+
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
23
|
+
python: ["3.10", "3.13"]
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: ${{ matrix.python }}
|
|
29
|
+
cache: pip
|
|
30
|
+
- run: python -m pip install --upgrade pip
|
|
31
|
+
- run: pip install . pytest
|
|
32
|
+
- run: pytest -q
|
|
33
|
+
- run: metric-diff matrix --case reg- --case bin-f1
|
|
34
|
+
|
|
35
|
+
full:
|
|
36
|
+
# Every supported library. torch is installed from the CPU-only index to keep CI fast.
|
|
37
|
+
name: full / ${{ matrix.os }} / py${{ matrix.python }}
|
|
38
|
+
runs-on: ${{ matrix.os }}
|
|
39
|
+
timeout-minutes: 45
|
|
40
|
+
strategy:
|
|
41
|
+
fail-fast: false
|
|
42
|
+
matrix:
|
|
43
|
+
include:
|
|
44
|
+
- { os: ubuntu-latest, python: "3.10" }
|
|
45
|
+
- { os: ubuntu-latest, python: "3.11" }
|
|
46
|
+
- { os: ubuntu-latest, python: "3.12" }
|
|
47
|
+
- { os: ubuntu-latest, python: "3.13" }
|
|
48
|
+
- { os: windows-latest, python: "3.12" }
|
|
49
|
+
- { os: macos-latest, python: "3.12" }
|
|
50
|
+
env:
|
|
51
|
+
KERAS_BACKEND: torch
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@v4
|
|
54
|
+
- uses: actions/setup-python@v5
|
|
55
|
+
with:
|
|
56
|
+
python-version: ${{ matrix.python }}
|
|
57
|
+
cache: pip
|
|
58
|
+
- run: python -m pip install --upgrade pip
|
|
59
|
+
- name: Install CPU-only torch
|
|
60
|
+
if: runner.os != 'macOS'
|
|
61
|
+
run: pip install torch --index-url https://download.pytorch.org/whl/cpu
|
|
62
|
+
- run: pip install -e ".[all]" pytest
|
|
63
|
+
- run: pytest -q -o addopts="" -rs
|
|
64
|
+
- name: Conformance matrix
|
|
65
|
+
run: metric-diff matrix --format markdown --output matrix.md
|
|
66
|
+
- uses: actions/upload-artifact@v4
|
|
67
|
+
with:
|
|
68
|
+
name: matrix-${{ matrix.os }}-py${{ matrix.python }}
|
|
69
|
+
path: matrix.md
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes are listed here. This project follows [semantic versioning](https://semver.org/); while the version starts with 0, minor releases may change behaviour.
|
|
4
|
+
|
|
5
|
+
## 0.1.0a1 (first public alpha)
|
|
6
|
+
|
|
7
|
+
### Compare libraries
|
|
8
|
+
- `compare()` / `metric-diff <metric>`: computes a metric with every installed library (scikit-learn, torchmetrics, torcheval, Keras 3, Hugging Face evaluate, MONAI) and, when they disagree, finds the cause and **confirms** it by re-running every library with that setting aligned.
|
|
9
|
+
- Classification: accuracy, precision, recall, F1, AUROC, average precision (binary and multiclass; labels, probabilities or logits).
|
|
10
|
+
- Regression: R2, MAE, MSE, RMSE, MAPE (single and multi-output).
|
|
11
|
+
- Segmentation: Dice and IoU on label maps (2-D and 3-D).
|
|
12
|
+
- Your own settings, for every library or per library: `average`, `threshold`, `pos_label`, `num_classes`, `zero_division`, `top_k`, `include_background`, `aggregation`, `settings={lib: {...}}`. Libraries that can't honour a setting are reported as skipped, with the reason.
|
|
13
|
+
- 25 detectors, including default averaging, logits vs probabilities, sigmoid saturation of large logits (torchmetrics#2819), threshold ties, binary labels other than {0, 1}, Keras defaults (F1 without threshold, per-column precision/recall, AUC clipping and 200-threshold binning, PR-AUC vs average precision, MAPE as a percentage), MAPE with zero targets, constant-target R2, float32 rounding on large values, per-image vs whole-dataset segmentation, MONAI `ignore_empty`, and background handling.
|
|
14
|
+
|
|
15
|
+
### Batches
|
|
16
|
+
- `compare_batched()` / `--batch-size`: per-batch averages vs accumulated `update()`/`compute()` vs the whole dataset; flags batches left out, duplicated samples (DistributedSampler padding, `--expected-n`) and dropped samples. Explains Keras' 1-D target accumulation and torchmetrics' `MeanIoU` class vs `mean_iou` function.
|
|
17
|
+
|
|
18
|
+
### Conformance matrix
|
|
19
|
+
- `metric-diff matrix` / `run_matrix()`: 30 edge cases on every installed library, as a terminal table, Markdown or JSON; `--save` and `--baseline` detect drift between library versions (exit code 1, for CI).
|
|
20
|
+
|
|
21
|
+
### Documentation and benchmarks
|
|
22
|
+
- Scenario-based [user guide](docs/USER_GUIDE.md); every Python example in it is tested.
|
|
23
|
+
- Benchmarks on real model predictions: scikit-learn datasets (`benchmarks/real_data.py`) and pretrained Hugging Face models on SST-2 and ADE20K (`benchmarks/hf_data.py`).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Code of Conduct
|
|
2
|
+
|
|
3
|
+
metric-diff follows the [Contributor Covenant, version 2.1](https://www.contributor-covenant.org/version/2/1/code_of_conduct/).
|
|
4
|
+
|
|
5
|
+
In short: be respectful and constructive, assume good faith, and focus on the problem rather than the person. This includes how we talk about other projects: when a library behaves differently, describe the difference precisely and kindly.
|
|
6
|
+
|
|
7
|
+
Harassment, personal attacks, discriminatory language and publishing others' private information are not acceptable in issues, pull requests, discussions or any other project space.
|
|
8
|
+
|
|
9
|
+
## Reporting
|
|
10
|
+
|
|
11
|
+
If you experience or witness unacceptable behaviour, contact the maintainer privately through their GitHub profile, [github.com/DadCoder001](https://github.com/DadCoder001). Reports are handled confidentially. The maintainer may remove, edit or reject contributions, and temporarily or permanently ban participants, for behaviour they consider inappropriate, following the enforcement guidelines of the Contributor Covenant.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Contributing to metric-diff
|
|
2
|
+
|
|
3
|
+
Thanks for helping! The most valuable contributions are **new mismatches**: a metric that gives different numbers in different libraries, with the reason. Each one becomes a detector (so `compare()` can explain it) and an edge case (so the conformance matrix watches it across library versions).
|
|
4
|
+
|
|
5
|
+
## Ways to help
|
|
6
|
+
|
|
7
|
+
- **Report an unexplained mismatch**: when metric-diff says "no known cause", open an issue with the *Unexplained mismatch* template and the `--json` output.
|
|
8
|
+
- **Report a known difference** we don't cover yet: *New edge case* template.
|
|
9
|
+
- **Add a detector or an edge case**: see below.
|
|
10
|
+
- **Improve the user guide**: scenarios people actually hit are the best documentation.
|
|
11
|
+
|
|
12
|
+
Questions and ideas are welcome in [Discussions](https://github.com/DadCoder001/metric-diff/discussions).
|
|
13
|
+
|
|
14
|
+
## Development setup
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/DadCoder001/metric-diff
|
|
18
|
+
cd metric-diff
|
|
19
|
+
python -m venv .venv && . .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
20
|
+
pip install torch --index-url https://download.pytorch.org/whl/cpu # optional: CPU-only torch is enough
|
|
21
|
+
pip install -e ".[dev]"
|
|
22
|
+
pytest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Tests that need a library you haven't installed skip themselves; the Hugging Face `evaluate` tests download metric scripts the first time.
|
|
26
|
+
|
|
27
|
+
## How metric-diff is organised
|
|
28
|
+
|
|
29
|
+
| File | What it does |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `src/metric_diff/inputs.py` | Validates inputs and infers the task (binary, multiclass, regression, segmentation) |
|
|
32
|
+
| `src/metric_diff/backends.py` | One adapter per library, calling it the way a user would |
|
|
33
|
+
| `src/metric_diff/segmentation.py` | Segmentation adapters (Dice, IoU) |
|
|
34
|
+
| `src/metric_diff/detectors.py` | Known causes. Each detector can **align** one setting across libraries |
|
|
35
|
+
| `src/metric_diff/core.py` | `compare()`: runs every library, then tries detector alignments until the libraries agree |
|
|
36
|
+
| `src/metric_diff/batched.py` | `compare_batched()`: per-batch vs accumulated vs whole-dataset |
|
|
37
|
+
| `src/metric_diff/cases.py` / `matrix.py` | The edge-case library and the conformance matrix |
|
|
38
|
+
|
|
39
|
+
## Adding a detector
|
|
40
|
+
|
|
41
|
+
A detector is only useful if it can **prove** its explanation. In `detectors.py`:
|
|
42
|
+
|
|
43
|
+
1. `relevant(case, metric)`: cheap check that the cause could apply (e.g. "predictions are logits").
|
|
44
|
+
2. `transform(y_true, y_pred, case)` and/or `options(case, metric)`: how to align the setting across every library (apply sigmoid first, pass `average="macro"`, ...).
|
|
45
|
+
3. `explain(case, metric, backends)`: what differs and the fix, in plain language, naming the libraries and settings involved.
|
|
46
|
+
4. `requires` / `affects`: which library must be present, and which libraries' results it explains (used to pick the right cause when several alignments work).
|
|
47
|
+
5. Add it to `DETECTORS`. Order matters only when transforms are combined.
|
|
48
|
+
|
|
49
|
+
Then add a test in `tests/` that shows **both** that the libraries disagree with their defaults **and** that metric-diff reports your cause as confirmed. If the upstream library later fixes the behaviour, the first assertion fails and tells us to update the case.
|
|
50
|
+
|
|
51
|
+
## Adding an edge case to the matrix
|
|
52
|
+
|
|
53
|
+
Append an `EdgeCase` to `CASES` in `src/metric_diff/cases.py`: a short id, a title, the metric, a function returning small deterministic `(y_true, y_pred)`, any settings, and the upstream issue if there is one. Keep data tiny; the matrix runs every case on every library.
|
|
54
|
+
|
|
55
|
+
## Pull requests
|
|
56
|
+
|
|
57
|
+
- One topic per pull request; describe what changes and link the issue.
|
|
58
|
+
- `pytest` must pass. The user guide's Python examples are run as tests too.
|
|
59
|
+
- Be precise and kind about other libraries: most differences are reasonable design choices, not bugs. When something does look like a bug, link or file an upstream issue with a minimal reproduction.
|
|
60
|
+
|
|
61
|
+
## Response times
|
|
62
|
+
|
|
63
|
+
metric-diff is maintained in spare time. Issues and pull requests are usually looked at within a week; please be patient if it takes longer.
|
|
64
|
+
|
|
65
|
+
By contributing you agree that your contributions are licensed under the project's [MIT License](LICENSE) and that you'll follow the [Code of Conduct](CODE_OF_CONDUCT.md).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 metric-diff contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|