Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
3pia
CMS Analyses
Tools
Commits
ecedc074
Commit
ecedc074
authored
4 years ago
by
Dennis Noll
Browse files
Options
Downloads
Patches
Plain Diff
[plotting] black
parent
ccaa2da8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plotting.py
+31
-10
31 additions, 10 deletions
plotting.py
with
31 additions
and
10 deletions
plotting.py
+
31
−
10
View file @
ecedc074
...
...
@@ -73,7 +73,13 @@ def figure_confusion_matrix(
plt
.
yticks
(
tick_marks
,
class_names
)
for
i
,
j
in
itertools
.
product
(
range
(
cm
.
shape
[
0
]),
range
(
cm
.
shape
[
1
])):
plt
.
text
(
j
,
i
,
np
.
around
(
cm
[
i
,
j
],
decimals
=
2
),
horizontalalignment
=
"
center
"
,
size
=
7
)
plt
.
text
(
j
,
i
,
np
.
around
(
cm
[
i
,
j
],
decimals
=
2
),
horizontalalignment
=
"
center
"
,
size
=
7
,
)
plt
.
ylabel
(
"
True label
"
+
"
(normed)
"
*
(
normalize
==
"
true
"
))
plt
.
xlabel
(
"
Predicted label
"
+
"
(normed)
"
*
(
normalize
==
"
pred
"
))
...
...
@@ -109,18 +115,18 @@ def figure_history(history_csv_path):
def
plot_histories
(
history_csv_path
,
path
,
cut
=
None
,
roll
=
1
):
p
df
=
pd
.
read_csv
(
history_csv_path
)
p
df
=
p
df
.
set_index
(
"
epoch
"
)
p
df
=
p
df
.
truncate
(
after
=
cut
)
for
col
in
p
df
.
columns
:
df
=
pd
.
read_csv
(
history_csv_path
)
df
=
df
.
set_index
(
"
epoch
"
)
df
=
df
.
truncate
(
after
=
cut
)
for
col
in
df
.
columns
:
if
col
.
startswith
(
"
val_
"
):
continue
fig
=
plt
.
figure
()
if
"
val_
"
+
col
in
p
df
.
columns
:
if
"
val_
"
+
col
in
df
.
columns
:
ind
=
[
col
,
"
val_
"
+
col
]
else
:
ind
=
col
value
=
p
df
[
ind
]
value
=
df
[
ind
]
ax
=
value
.
rolling
(
roll
,
min_periods
=
1
).
mean
().
plot
()
ax
.
set_xlabel
(
"
Epoch
"
)
ax
.
set_ylabel
(
col
.
capitalize
())
...
...
@@ -228,7 +234,13 @@ def figure_node_activations(
def
figure_roc_curve
(
truth
,
prediction
,
indices
=
[
0
],
class_names
=
None
,
sample_weight
=
None
,
lw
=
2
,
scale
=
"
linear
"
truth
,
prediction
,
indices
=
[
0
],
class_names
=
None
,
sample_weight
=
None
,
lw
=
2
,
scale
=
"
linear
"
,
):
fig
=
plt
.
figure
()
for
index
in
indices
:
...
...
@@ -310,7 +322,13 @@ def figure_inputs(
def
figure_weight_study
(
class_inps
,
sample_weights
=
None
,
columns
=
None
,
label
=
None
,
log
=
False
,
mode
=
"
plain
"
,
**
kwargs
class_inps
,
sample_weights
=
None
,
columns
=
None
,
label
=
None
,
log
=
False
,
mode
=
"
plain
"
,
**
kwargs
,
):
multiplot
=
Multiplot
(
class_inps
[
0
].
shape
[
1
:][::
-
1
])
rows
,
cols
=
multiplot
.
lenghts
()
...
...
@@ -352,7 +370,10 @@ def figure_weight_study(
if
mode
==
"
weight
"
:
mask
=
sample_weights
[
0
]
>
0
pos_feat
,
pos_weight
=
class_inps
[
0
][:,
feat
][
mask
],
sample_weights
[
0
][
mask
]
neg_feat
,
neg_weight
=
class_inps
[
0
][:,
feat
][
~
mask
],
sample_weights
[
0
][
~
mask
]
neg_feat
,
neg_weight
=
(
class_inps
[
0
][:,
feat
][
~
mask
],
sample_weights
[
0
][
~
mask
],
)
val_pos
,
bins
=
np
.
histogram
(
pos_feat
,
bins
=
bins
,
weights
=
pos_weight
)
val_neg
,
bins
=
np
.
histogram
(
neg_feat
,
bins
=
bins
,
weights
=
neg_weight
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment