Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
antifragility
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ana Pamela Osuna Vargas
antifragility
Commits
e8dab1d3
Commit
e8dab1d3
authored
Dec 08, 2019
by
Pamela Osuna
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confusion matrix added
parent
34062b83
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
cnn.py
+7
-3
No files found.
cnn.py
View file @
e8dab1d3
import
parser
import
models
as
m
import
roc_auc
as
ra
import
sys
from
confusion_matrix
import
confusion_matrix
import
numpy
as
np
from
sklearn.model_selection
import
train_test_split
...
...
@@ -172,7 +172,7 @@ def run_kfold(X_train, X_test, y_train, y_test, params):
# calculate area under the curve
y_pred
=
model
.
predict
(
X_validation
,
batch_size
=
bs
)
fpr
,
tpr
,
auc
=
ra
.
roc_auc
(
N_CLASSES
,
validation_Y_one_ho
t
,
y_pred
)
fpr
,
tpr
,
auc
=
ra
.
roc_auc
(
N_CLASSES
,
y_tes
t
,
y_pred
)
total_auc
+=
auc
print
(
"Area under the curve:"
,
auc
)
...
...
@@ -182,4 +182,8 @@ def run_kfold(X_train, X_test, y_train, y_test, params):
print
(
"Average accuracy: "
,
total_acc
)
print
(
"Average area under the curve: "
,
total_auc
)
return
total_acc
,
total_auc
# confusion matrix
cm
=
confusion_matrix
(
y_test
.
argmax
(
axis
=
1
),
y_pred
.
argmax
(
axis
=
1
))
return
total_acc
,
total_auc
,
cm
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