Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: deprecated trapz replaced with trapezoid #96

Merged
merged 9 commits into from
Jan 21, 2025
Binary file added .coverage
Binary file not shown.
2 changes: 1 addition & 1 deletion .github/workflows/python-coverage-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install --upgrade uv tox tox-uv
- name: Get coverage xml (Python ${{ matrix.python-version }} - TensorFlow ${{ matrix.tf-version }} - Torch ${{ matrix.torch-version }})
run: tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }}-torch${{ matrix.torch-version }}-coverage | tr -d .)
- name: Get Cover
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-coverage-shield.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install --upgrade uv tox tox-uv
pip install coverage-badge
- name: Compute coverage (Python ${{ matrix.python-version }} - TensorFlow ${{ matrix.tf-version }} - Torch ${{ matrix.torch-version }})
run: tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }}-torch${{ matrix.torch-version }}-coverage | tr -d .)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install --upgrade uv tox tox-uv
- name: Test with tox
run: tox -e py$(echo ${{ matrix.python-version }} | tr -d .)-lint
2 changes: 1 addition & 1 deletion .github/workflows/python-tests-tf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install --upgrade uv tox tox-uv
- name: Test with tox (Python ${{ matrix.python-version }} - TensorFlow ${{ matrix.tf-version }})
run: tox -e py$(echo ${{ matrix.python-version }}-tf${{ matrix.tf-version }} | tr -d .)
2 changes: 1 addition & 1 deletion .github/workflows/python-tests-torch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
pip install --upgrade uv tox tox-uv
- name: Test with tox (Python ${{ matrix.python-version }} - Pytorch ${{ matrix.torch-version }})
run: tox -e py$(echo ${{ matrix.python-version }}-torch${{ matrix.torch-version }} | tr -d .)
5 changes: 4 additions & 1 deletion oodeel/eval/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ def bench_metrics(
for metric in metrics:
if isinstance(metric, str):
if metric == "auroc":
auroc = -np.trapz(1.0 - fpr, tpr)
if np.__version__ >= "2.0.0":
auroc = -np.trapezoid(1.0 - fpr, tpr)
else:
auroc = -np.trapz(1.0 - fpr, tpr)
metrics_dict["auroc"] = auroc

elif metric == "detect_acc":
Expand Down
11 changes: 8 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@ deps =
tf211: tensorflow ~= 2.11.0
tf211: tensorflow_datasets
tf211: tensorflow_probability ~= 0.19.0
install_command = uv pip install {opts} {packages}
commands =
tf24: pip install --force-reinstall numpy==1.20.0
tf25: pip install --force-reinstall numpy==1.20.0
tf24: uv pip install --force-reinstall numpy==1.21.0
tf25: uv pip install --force-reinstall numpy==1.21.0
tf28: uv pip install --force-reinstall numpy==1.24.0
tf211: uv pip install --force-reinstall numpy==1.26.0
pytest tests/tests_tensorflow

[testenv:py{38,39,310}-torch{17,19,110,111,113,200}]
Expand Down Expand Up @@ -99,7 +102,7 @@ deps =
torch113: torchvision == 0.14.1+cpu
torch200: torch
torch200: torchvision
install_command = pip install --extra-index-url https://download.pytorch.org/whl/cpu {opts} {packages}
install_command = uv pip install --extra-index-url https://download.pytorch.org/whl/cpu {opts} {packages}
commands =
pytest tests/tests_torch

Expand Down Expand Up @@ -135,6 +138,8 @@ deps =
tf211: tensorflow ~= 2.11.0
tf211: tensorflow_datasets
tf211: tensorflow_probability ~= 0.19.0
install_command = uv pip install {opts} {packages}
commands =
tf211: uv pip install --force-reinstall numpy==1.26.0
coverage run --source oodeel -m pytest
coverage xml
Loading