Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
MPBA Radiomics
RADLER
Commits
12b3447b
Commit
12b3447b
authored
Oct 29, 2019
by
Alessia Marcolini
Browse files
comment magics and add pandas
parent
cc494d23
Changes
1
Hide whitespace changes
Inline
Side-by-side
trainingTstage.py
View file @
12b3447b
...
...
@@ -8,8 +8,8 @@
# In[ ]:
get_ipython
().
run_line_magic
(
'reload_ext'
,
'autoreload'
)
get_ipython
().
run_line_magic
(
'autoreload'
,
'2'
)
#
get_ipython().run_line_magic('reload_ext', 'autoreload')
#
get_ipython().run_line_magic('autoreload', '2')
import
os
PATH
=
os
.
getcwd
()
...
...
@@ -28,6 +28,7 @@ import sys
import
time
import
numpy
as
np
import
pandas
as
pd
import
matplotlib.pyplot
as
plt
from
sklearn.metrics
import
matthews_corrcoef
as
mcor
,
accuracy_score
as
acc
,
recall_score
as
recall
,
precision_score
as
precision
,
confusion_matrix
import
torch
...
...
@@ -80,7 +81,7 @@ settings = {
'pretrained'
:
''
,
}
assert
settings
[
'split'
]
in
[
'valer
i
es'
,
'8020'
]
assert
settings
[
'split'
]
in
[
'val
i
eres'
,
'8020'
]
assert
settings
[
'pretrained'
]
in
[
'Med3D'
,
'branch-wise'
,
'T-stage'
,
''
]
os
.
makedirs
(
f
'
{
EXPERIMENT_DIR
}
/
{
EXPERIMENT_NAME
}
'
,
exist_ok
=
False
)
...
...
@@ -540,8 +541,6 @@ np.save(f'{EXPERIMENT_DIR}/{EXPERIMENT_NAME}/filenames_ts.npy', filenames_ts)
# In[ ]:
import
pandas
as
pd
metrics_out
=
pd
.
DataFrame
((
train_metrics
,
test_metrics
),
columns
=
[
'MCC'
,
'ACC'
,
'prec'
,
'rec'
],
index
=
[
'train'
,
'test'
])
metrics_out
.
to_csv
(
f
'
{
EXPERIMENT_DIR
}
/
{
EXPERIMENT_NAME
}
/metrics_out.csv'
,
index
=
False
)
...
...
Write
Preview
Supports
Markdown
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