Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FreeForestML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CERN
fsauerbu
FreeForestML
Merge requests
!17
Resolve "Add survival tests for all plotting methods"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Add survival tests for all plotting methods"
22-add-survival-tests-for-all-plotting-methods
into
master
Overview
0
Commits
4
Pipelines
1
Changes
1
Merged
Frank Sauerburger
requested to merge
22-add-survival-tests-for-all-plotting-methods
into
master
5 years ago
Overview
0
Commits
4
Pipelines
1
Changes
1
Expand
Closes
#22 (closed)
Edited
5 years ago
by
Frank Sauerburger
0
0
Merge request reports
Viewing commit
84801a4b
Prev
Next
Show latest version
1 file
+
25
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Unverified
84801a4b
Add confusion_matrix test
· 84801a4b
Frank Sauerburger
authored
5 years ago
nnfwtbn/tests/test_plot.py
+
25
−
1
Options
@@ -7,7 +7,7 @@ import matplotlib.pyplot as plt
from
nnfwtbn.variable
import
Variable
from
nnfwtbn.cut
import
Cut
from
nnfwtbn.process
import
Process
from
nnfwtbn.plot
import
roc
from
nnfwtbn.plot
import
roc
,
confusion_matrix
class
SurvivalTestCase
(
unittest
.
TestCase
):
@@ -68,3 +68,27 @@ class SurvivalTestCase(unittest.TestCase):
except
Exception
:
self
.
fail
(
"
Calling roc() failed.
"
)
def
test_confusion_matrix
(
self
):
"""
Check that calling confusion_matrix() does not raise an exception.
"""
df
=
pd
.
DataFrame
({
"
sick
"
:
[
0
,
1
,
1
,
0
,
0
],
"
positive
"
:
[
0
,
0
,
1
,
1
,
0
],
"
weight
"
:
[
1
,
1
,
1
,
1.7
,
1
],
})
positive
=
Cut
(
lambda
d
:
d
.
positive
==
1
,
label
=
"
+
"
)
negative
=
Cut
(
lambda
d
:
d
.
positive
==
0
,
label
=
"
-
"
)
sick
=
Cut
(
lambda
d
:
d
.
sick
==
1
,
label
=
"
sick
"
)
healthy
=
Cut
(
lambda
d
:
d
.
sick
==
0
,
label
=
"
healthy
"
)
try
:
data
=
confusion_matrix
(
df
,
[
positive
,
negative
],
[
sick
,
healthy
],
"
Test result
"
,
"
Truth
"
,
weight
=
Variable
(
"
weight
"
,
"
weight
"
),
annot
=
True
)
except
Exception
:
self
.
fail
(
"
Calling confusion_matrix() failed.
"
)
Loading