Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
exclude: '\.(svg|yml|csv|xml|cpg|prj)$'
Expand All @@ -13,7 +13,7 @@ repos:

# Notebooks: run Ruff via nbQA inside .ipynb
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.9.0
rev: 1.9.1
hooks:
- id: nbqa-ruff-format
additional_dependencies: [ruff]
Expand Down Expand Up @@ -43,7 +43,7 @@ repos:
)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.2
rev: v0.15.20
hooks:
- id: ruff-format
files: |
Expand Down
6 changes: 3 additions & 3 deletions src/deepforest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,9 +1236,9 @@ def evaluate(
self.predictions = pd.concat(self.predictions, ignore_index=True)
if "label" in self.predictions.columns:
self.predictions["label"] = self.predictions["label"].map(
lambda x: self.numeric_to_label_dict.get(int(x), x)
if pd.notna(x)
else x
lambda x: (
self.numeric_to_label_dict.get(int(x), x) if pd.notna(x) else x
)
)
else:
self.predictions = pd.DataFrame()
Expand Down
8 changes: 5 additions & 3 deletions src/deepforest/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,11 @@ def compute(self) -> dict:
for col in ["predicted_label", "true_label"]:
if col in self._all_results.columns:
self._all_results[col] = self._all_results[col].map(
lambda x: self.numeric_to_label_dict.get(int(x), x)
if pd.notna(x)
else x
lambda x: (
self.numeric_to_label_dict.get(int(x), x)
if pd.notna(x)
else x
)
)
# TODO Check why this fails for point predictions
if self.task == "box" and len(self.label_dict) > 1:
Expand Down
Loading