Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
C
covid_analysis
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
COMPARA
covid_analysis
Commits
e6fc4387
Commit
e6fc4387
authored
Jun 05, 2024
by
Joaquin Torres
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FP and FN were switched
parent
5359c86d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
20 deletions
+18
-20
model_selection/cv_metric_gen.py
model_selection/cv_metric_gen.py
+9
-10
model_selection/test_models.py
model_selection/test_models.py
+9
-10
No files found.
model_selection/cv_metric_gen.py
View file @
e6fc4387
...
...
@@ -113,26 +113,25 @@ def TN_scorer(clf, X, y):
"""Gives the number of samples predicted as true negatives"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
TN
=
cm
[
0
,
0
]
return
TN
return
cm
[
0
,
0
]
def
FN_scorer
(
clf
,
X
,
y
):
"""Gives the number of samples predicted as false negatives"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
FN
=
cm
[
0
,
1
]
return
FN
return
cm
[
1
,
0
]
def
FP_scorer
(
clf
,
X
,
y
):
"""Gives the number of samples predicted as false positive"""
"""Gives the number of samples predicted as false positive
s
"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
FP
=
cm
[
1
,
0
]
return
FP
return
cm
[
0
,
1
]
def
TP_scorer
(
clf
,
X
,
y
):
"""Gives the number of samples predicted as true positive"""
"""Gives the number of samples predicted as true positive
s
"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
TP
=
cm
[
1
,
1
]
return
TP
return
cm
[
1
,
1
]
def
negative_recall_scorer
(
clf
,
X
,
y
):
"""Gives the negative recall defined as the (number of true_negative_samples)/(total number of negative samples)"""
...
...
model_selection/test_models.py
View file @
e6fc4387
...
...
@@ -124,26 +124,25 @@ def TN_scorer(clf, X, y):
"""Gives the number of samples predicted as true negatives"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
TN
=
cm
[
0
,
0
]
return
TN
return
cm
[
0
,
0
]
def
FN_scorer
(
clf
,
X
,
y
):
"""Gives the number of samples predicted as false negatives"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
FN
=
cm
[
0
,
1
]
return
FN
return
cm
[
1
,
0
]
def
FP_scorer
(
clf
,
X
,
y
):
"""Gives the number of samples predicted as false positive"""
"""Gives the number of samples predicted as false positive
s
"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
FP
=
cm
[
1
,
0
]
return
FP
return
cm
[
0
,
1
]
def
TP_scorer
(
clf
,
X
,
y
):
"""Gives the number of samples predicted as true positive"""
"""Gives the number of samples predicted as true positive
s
"""
y_pred
=
clf
.
predict
(
X
)
cm
=
confusion_matrix
(
y
,
y_pred
)
TP
=
cm
[
1
,
1
]
return
TP
return
cm
[
1
,
1
]
def
negative_recall_scorer
(
clf
,
X
,
y
):
"""Gives the negative recall defined as the (number of true_negative_samples)/(total number of negative samples)"""
...
...
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