Skip to content

Commit 5c3eb5b

Browse files
committed
Fix COMB max_contam empty list issue
1 parent 90637bc commit 5c3eb5b

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v5.0.0
3+
rev: v6.0.0
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -14,14 +14,14 @@ repos:
1414
args: [--fix=lf]
1515

1616
- repo: https://github.com/DanielNoord/pydocstringformatter
17-
rev: v0.7.3
17+
rev: v0.7.5
1818
hooks:
1919
- id: pydocstringformatter
2020
args: [--style=pep257, --style=numpydoc]
2121
name: Format docstrings
2222

2323
- repo: https://github.com/asottile/pyupgrade
24-
rev: v3.20.0
24+
rev: v3.21.2
2525
hooks:
2626
- id: pyupgrade
2727
args: [--py38-plus]
@@ -35,14 +35,14 @@ repos:
3535
name: Format code style
3636

3737
- repo: https://github.com/PyCQA/isort
38-
rev: 6.0.1
38+
rev: 7.0.0
3939
hooks:
4040
- id: isort
4141
args: [-m=3]
4242
name: Sort imports
4343

4444
- repo: https://github.com/charliermarsh/ruff-pre-commit
45-
rev: v0.12.8
45+
rev: v0.14.7
4646
hooks:
4747
- id: ruff
4848
args: [--exit-non-zero-on-fix, --fix, --line-length=180]

pythresh/thresholds/comb.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ def eval(self, decision):
118118
contam.append(labels)
119119
ratio.append(outlier_ratio)
120120

121+
if not contam:
122+
raise ValueError(
123+
f"No thresholders had a contamination level below {self.max_contam}. Try increasing max_contam value.")
124+
121125
contam = np.array(contam)
122126
ratio = np.array(ratio)
123127

0 commit comments

Comments
 (0)