Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Supervised MultiModal Integration Tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Baptiste Bauvin
Supervised MultiModal Integration Tool
Commits
df459c7b
Commit
df459c7b
authored
5 years ago
by
Baptiste Bauvin
Browse files
Options
Downloads
Patches
Plain Diff
Added plotly for metrics
parent
22ce8b65
No related branches found
No related tags found
No related merge requests found
Pipeline
#3867
passed
5 years ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
multiview_platform/mono_multi_view_classifiers/result_analysis.py
+23
-5
23 additions, 5 deletions
...w_platform/mono_multi_view_classifiers/result_analysis.py
with
23 additions
and
5 deletions
multiview_platform/mono_multi_view_classifiers/result_analysis.py
+
23
−
5
View file @
df459c7b
...
...
@@ -77,7 +77,7 @@ def plot_results_noise(directory, noise_results, metric_to_plot, name, width=0.1
def
plot_metric_scores
(
train_scores
,
test_scores
,
names
,
nb_results
,
metric_name
,
file_name
,
tag
=
""
,
train_STDs
=
None
,
test_STDs
=
None
):
tag
=
""
,
train_STDs
=
None
,
test_STDs
=
None
,
use_plotly
=
True
):
r
"""
Used to plot and save the score barplot for a specific metric.
Parameters
...
...
@@ -145,10 +145,28 @@ def plot_metric_scores(train_scores, test_scores, names, nb_results, metric_name
test_STDs
.
reshape
((
train_scores
.
shape
[
0
],
1
))),
axis
=
1
)),
columns
=
names
,
index
=
[
"
Train
"
,
"
Train STD
"
,
"
Test
"
,
"
Test STD
"
])
dataframe
.
to_csv
(
file_name
+
"
.csv
"
)
if
use_plotly
:
fig
=
plotly
.
graph_objs
.
Figure
()
fig
.
add_trace
(
plotly
.
graph_objs
.
Bar
(
name
=
'
Train
'
,
x
=
names
,
y
=
train_scores
,
error_y
=
dict
(
type
=
'
data
'
,
array
=
train_STDs
),
marker_color
=
"
lightgrey
"
,
))
fig
.
add_trace
(
plotly
.
graph_objs
.
Bar
(
name
=
'
Test
'
,
x
=
names
,
y
=
test_scores
,
error_y
=
dict
(
type
=
'
data
'
,
array
=
test_STDs
),
marker_color
=
"
black
"
,
))
fig
.
update_layout
(
title
=
metric_name
+
"
\n
"
+
tag
+
"
scores for each classifier
"
)
plotly
.
offline
.
plot
(
fig
,
filename
=
file_name
+
"
.html
"
,
auto_open
=
False
)
del
fig
def
plot_2d
(
data
,
classifiers_names
,
nbClassifiers
,
nbExamples
,
file
N
ame
,
minSize
=
10
,
labels
=
None
,
file
_n
ame
,
minSize
=
10
,
labels
=
None
,
width_denominator
=
2.0
,
height_denominator
=
20.0
,
stats_iter
=
1
,
use_plotly
=
True
,
example_ids
=
None
):
r
"""
Used to generate a 2D plot of the errors.
...
...
@@ -166,7 +184,7 @@ def plot_2d(data, classifiers_names, nbClassifiers, nbExamples,
The number of examples.
nbCopies : int
The number of times the data is copied (classifier wise) in order for the figure to be more readable
file
N
ame : str
file
_n
ame : str
The name of the file in which the figure will be saved (
"
error_analysis_2D.png
"
will be added at the end)
minSize : int, optinal, default: 10
The minimum width and height of the figure.
...
...
@@ -191,7 +209,7 @@ def plot_2d(data, classifiers_names, nbClassifiers, nbExamples,
cbar
=
fig
.
colorbar
(
cax
,
ticks
=
[
-
100
*
stats_iter
/
2
,
0
,
stats_iter
])
cbar
.
ax
.
set_yticklabels
([
'
Unseen
'
,
'
Always Wrong
'
,
'
Always Right
'
])
fig
.
savefig
(
file
N
ame
+
"
error_analysis_2D.png
"
,
bbox_inches
=
"
tight
"
,
transparent
=
True
)
fig
.
savefig
(
file
_n
ame
+
"
error_analysis_2D.png
"
,
bbox_inches
=
"
tight
"
,
transparent
=
True
)
plt
.
close
()
### The following part is used to generate an interactive graph.
if
use_plotly
:
...
...
@@ -215,7 +233,7 @@ def plot_2d(data, classifiers_names, nbClassifiers, nbExamples,
fig
.
update_xaxes
(
showticklabels
=
False
,
row
=
row_index
+
1
,
col
=
1
)
fig
.
update_xaxes
(
showticklabels
=
True
,
row
=
len
(
label_index_list
),
col
=
1
)
plotly
.
offline
.
plot
(
fig
,
filename
=
file
N
ame
+
"
error_analysis_2D.html
"
,
auto_open
=
False
)
plotly
.
offline
.
plot
(
fig
,
filename
=
file
_n
ame
+
"
error_analysis_2D.html
"
,
auto_open
=
False
)
del
fig
...
...
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