Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
pyg_autoscale
Commits
67bf815a
Commit
67bf815a
authored
Jun 09, 2021
by
rusty1s
Browse files
try catch for zerodvisionerror
parent
cf66b327
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
torch_geometric_autoscale/utils.py
torch_geometric_autoscale/utils.py
+5
-4
No files found.
torch_geometric_autoscale/utils.py
View file @
67bf815a
...
...
@@ -24,11 +24,12 @@ def compute_micro_f1(logits: Tensor, y: Tensor,
tp
=
int
((
y_true
&
y_pred
).
sum
())
fp
=
int
((
~
y_true
&
y_pred
).
sum
())
fn
=
int
((
y_true
&
~
y_pred
).
sum
())
precision
=
tp
/
(
tp
+
fp
)
if
(
tp
+
fp
)
>
0
else
0.
recall
=
tp
/
(
tp
+
fn
)
if
(
tp
+
fn
)
>
0
else
0.
if
precision
+
recall
>
0
:
try
:
precision
=
tp
/
(
tp
+
fp
)
recall
=
tp
/
(
tp
+
fn
)
return
2
*
(
precision
*
recall
)
/
(
precision
+
recall
)
e
lse
:
e
xcept
ZeroDivisionError
:
return
0.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment