Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMC-SOG
experiments
hybrid
Commits
258fa6b2
Commit
258fa6b2
authored
Apr 07, 2020
by
Jaime Arias
Browse files
update timeout
parent
bdc02871
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/plot-results.ipynb
View file @
258fa6b2
...
...
@@ -935,7 +935,7 @@
"outputs": [],
"source": [
"ZERO = 10e-5\n",
"TIMEOUT =
3
* 60 #
3
minutes =
18
0 seconds"
"TIMEOUT =
5
* 60 #
5
minutes =
30
0 seconds"
]
},
{
...
...
%% Cell type:code id: tags:
```
python
import
os
import
pandas
as
pd
import
plotly.io
as
pio
import
plotly.express
as
px
import
plotly.graph_objs
as
go
from
itertools
import
combinations
from
plotly.subplots
import
make_subplots
import
plotly.io
as
pio
# render figures in notebook
pio
.
renderers
.
default
=
"notebook_connected"
# templates figures
px
.
defaults
.
template
=
"simple_white"
pio
.
templates
.
default
=
"simple_white"
# layout for all figures
LAYOUT_FIGURES
=
dict
(
autosize
=
False
,
width
=
500
,
height
=
500
,
xaxis
=
dict
(
constrain
=
"domain"
,
mirror
=
True
,
showexponent
=
"all"
,
exponentformat
=
"power"
),
yaxis
=
dict
(
scaleanchor
=
"x"
,
scaleratio
=
1
,
mirror
=
True
,
showexponent
=
"all"
,
exponentformat
=
"power"
),
title
=
dict
(
y
=
0.9
,
x
=
0.5
,
xanchor
=
'center'
,
yanchor
=
'top'
)
)
```
%% Cell type:markdown id: tags:
# Auxiliary Functions
%% Cell type:code id: tags:
```
python
def
create_folder
(
path
):
"""Creates a folder if it does not exist
Parameters
----------
path : str
Path of the new folder
Examples
--------
>>> create_folder('./results')
"""
if
not
os
.
path
.
exists
(
path
):
os
.
makedirs
(
path
)
```
%% Cell type:code id: tags:
```
python
def
create_figure
(
df
,
model
):
"""Creates a scatter figure showing the time taken by each tool to verify each property of a model
Parameters
----------
df : pandas.Dataframe
Dataframe containing the results of the experiments
model : string
model to be plotted
Returns
-------
plotly.graph_objects.Figure
Scatter figure
Examples
--------
>>> import os
>>> import pandas as pd
>>> csv_file = os.path.join("results", "output.csv")
>>> df = pd.read_csv(csv_file)
>>> fig = create_figure(df, 'philo10')
"""
model_df
=
df
[
df
.
model
==
model
]
figure
=
px
.
scatter
(
model_df
,
x
=
"formula"
,
y
=
"time"
,
title
=
model
,
color
=
"tool"
,
symbol_sequence
=
[
'x'
])
figure
.
update_layout
(
yaxis_title
=
"time (s)"
,
title
=
LAYOUT_FIGURES
[
'title'
])
return
figure
```
%% Cell type:code id: tags:
```
python
def
get_axis_title
(
experiment
,
show_strategy
=
True
):
"""Get the axis title of a figure depending on the experiment being plotted
Parameters
----------
experiment : str
String with the experiment information
show_strategy : bool, optional
Flag to show the information related to the strategy used by the tool
Returns
-------
str
axis title
Examples
--------
>>> get_axis_title('pmc-sog_otfL_couv99-default_1_1', True)
pmc-sog (Lace, strategy: couv99-default, # cores: 1)
"""
information
=
experiment
.
split
(
'_'
)
tool_name
=
information
[
0
]
info
=
[]
if
(
len
(
information
)
==
5
):
library
=
'Lace'
if
(
information
[
1
]
==
'otfL'
)
else
'Pthreads'
info
.
append
(
library
)
if
(
show_strategy
):
info
.
append
(
'strategy: {}'
.
format
(
information
[
-
3
]))
nb_nodes
=
int
(
information
[
-
2
])
if
(
nb_nodes
>
1
):
info
.
append
(
'# nodes: {}'
.
format
(
nb_nodes
))
info
.
append
(
'# cores: {}'
.
format
(
information
[
-
1
]))
title
=
'{} ({})'
.
format
(
tool_name
,
', '
.
join
(
info
))
return
title
```
%% Cell type:code id: tags:
```
python
def
create_log_figure
(
table
,
table_errors
,
model
,
tool_x
,
tool_y
,
show_strategy
=
True
):
"""Creates a Scatter figure in logarithmic scale comparing the performance of two tools
Parameters
----------
table : pandas.Dataframe
Dataframe with the times of each experiment
table_errors : pandas.Dataframe
Dataframe with the errors of each experiment
model : string
Model to be analyzed
tool_x : string
Tool to be compared and plotted on the x-axis
tool_y : string
Tool to be compared and plotted on the y-axis
show_strategy : bool
Flag to show the stretagy used by the tools
Returns
-------
plotly.graph_objects.Figure
Scatter figure
Examples
--------
>>> import os
>>> import pandas as pd
>>> csv_file = os.path.join("results", "output.csv")
>>> df = pd.read_csv(csv_file)
>>> table = df.set_index(['model', 'formula', 'tool'], drop=True).unstack('tool')
>>> fig = create_log_figure(table['time'], table['error'], 'philo10', 'pmc-sog_otfL_couv99-default_1_8', 'pmc-sog_otfP_couv99-default_1_8')
"""
try
:
min_values
=
table
.
loc
[
model
].
min
()
max_values
=
table
.
loc
[
model
].
max
()
min_value
=
min
(
min_values
[
tool_x
],
min_values
[
tool_y
])
/
2.
max_value
=
max
(
max_values
[
tool_x
],
max_values
[
tool_y
])
figure
=
px
.
scatter
(
table
.
loc
[
model
],
title
=
model
,
x
=
tool_x
,
y
=
tool_y
,
log_x
=
True
,
log_y
=
True
,
range_x
=
[
min_value
,
max_value
],
range_y
=
[
min_value
,
max_value
],
color
=
"property"
,
hover_data
=
[
[
'formula #{}'
.
format
(
i
)
for
i
in
table
.
loc
[
model
].
index
],
table_errors
.
loc
[
model
,
tool_x
],
table_errors
.
loc
[
model
,
tool_y
]
],
color_discrete_map
=
{
"T"
:
"green"
,
"F"
:
"red"
,
"U"
:
"black"
},
symbol_sequence
=
[
"circle-open"
])
line
=
go
.
Scatter
(
x
=
[
min_value
,
max_value
],
y
=
[
min_value
,
max_value
],
mode
=
'lines'
,
showlegend
=
False
,
line
=
dict
(
color
=
'black'
,
width
=
1
))
figure
.
add_traces
(
line
)
figure
.
update_layout
(
LAYOUT_FIGURES
,
xaxis_title
=
get_axis_title
(
tool_x
,
show_strategy
),
yaxis_title
=
get_axis_title
(
tool_y
,
show_strategy
))
return
figure
except
Exception
as
e
:
print
(
"Error when ploting model: {} - tool_x: {} - tool_y: {}"
.
format
(
model
,
tool_x
,
tool_y
))
print
(
e
)
```
%% Cell type:code id: tags:
```
python
# Experiment filters
def
versus_dfs
(
experiments
):
"""Selects only experiments using DFS strategy"""
exp1
,
exp2
=
experiments
strategy_exp1
=
exp1
.
split
(
'_'
)[
1
]
strategy_exp2
=
exp2
.
split
(
'_'
)[
1
]
return
strategy_exp1
==
'dfs'
or
strategy_exp2
==
'dfs'
def
versus_sequential
(
experiments
):
"""Selects only experiments run sequentially """
exp1
,
exp2
=
experiments
nodes_exp1
,
threads_exp1
=
exp1
.
split
(
'_'
)[
-
2
:]
nodes_exp2
,
threads_exp2
=
exp2
.
split
(
'_'
)[
-
2
:]
return
(
nodes_exp1
==
'1'
and
nodes_exp2
==
'1'
)
and
\
(
threads_exp1
==
'1'
or
threads_exp2
==
'1'
)
def
same_tool
(
experiments
,
tool
):
"""Selects only experiments comparing the same tool"""
exp1
,
exp2
=
experiments
tool_exp1
=
exp1
.
split
(
'_'
)[
0
]
tool_exp2
=
exp2
.
split
(
'_'
)[
0
]
return
tool_exp1
.
startswith
(
tool
)
and
tool_exp2
.
startswith
(
tool
)
def
same_number_threads
(
experiments
):
"""Selects only experiments comparing the same number of processes and cores"""
exp1
,
exp2
=
experiments
nodes_exp1
,
threads_exp1
=
exp1
.
split
(
'_'
)[
-
2
:]
nodes_exp2
,
threads_exp2
=
exp2
.
split
(
'_'
)[
-
2
:]
return
(
nodes_exp1
==
nodes_exp2
)
and
(
threads_exp1
==
threads_exp2
)
def
same_thread_library
(
experiments
):
"""Selects only experiments comparing the same parallelization library"""
exp1
,
exp2
=
experiments
library_exp1
=
exp1
.
split
(
'_'
)[
1
]
library_exp2
=
exp2
.
split
(
'_'
)[
1
]
return
library_exp1
==
library_exp2
def
same_strategy
(
experiments
):
"""Selects only experiments comparing the same strategy"""
exp1
,
exp2
=
experiments
strategy_exp1
=
exp1
.
split
(
'_'
)[
2
]
strategy_exp2
=
exp2
.
split
(
'_'
)[
2
]
return
strategy_exp1
==
strategy_exp2
def
only_couvreur_strategy
(
experiments
):
"""Selects only experiments comparing couvreur emptiness check algorithm"""
exp1
,
exp2
=
experiments
strategy_exp1
=
exp1
.
split
(
'_'
)[
2
]
strategy_exp2
=
exp2
.
split
(
'_'
)[
2
]
return
strategy_exp1
.
startswith
(
'couv99'
)
and
strategy_exp2
.
startswith
(
'couv99'
)
def
compare_threads_library
(
experiments
):
"""Compares parallization libraries used in pmc-sog.
It selects experiments where the tool is only pmc-sog and the strategy, number of threads,
number of processus are the same.
"""
return
same_tool
(
experiments
,
'pmc-sog'
)
and
\
same_strategy
(
experiments
)
and
\
same_number_threads
(
experiments
)
and
\
not
same_thread_library
(
experiments
)
def
compare_couvreur_strategies
(
experiments
):
"""Compares couvreurs strategies used in pmc-sog.
It selects experiments where the tool is only pmc-sog, the strategy is couvreur, and
the parallelization library, number of threads, number of processus are the same.
"""
return
only_couvreur_strategy
(
experiments
)
and
\
same_thread_library
(
experiments
)
and
\
same_number_threads
(
experiments
)
def
compare_tools
(
experiments
):
"""Compares pmc-sog and pnml2lts-mc using the DFS algorithm.
It selects experiments where the tools are not the same, the exploration algorithm is DFS and
the number of processus and cores are the same.
"""
return
same_number_threads
(
experiments
)
and
\
not
(
same_tool
(
experiments
,
'pmc-sog'
)
or
same_tool
(
experiments
,
'pnml2lts-mc'
))
and
\
versus_dfs
(
experiments
)
def
compare_multithreading
(
experiments
):
"""Compares the sequential and multi-core version of pmc-sog.
It selects experiments where the tools is pmc-sog, the parallelization library, the emptiness check
strategy are the same. Here the number of processus and cores are different.
"""
return
same_tool
(
experiments
,
'pmc-sog'
)
and
\
same_thread_library
(
experiments
)
and
\
same_strategy
(
experiments
)
and
\
versus_sequential
(
experiments
)
# Plots to be created
plots
=
{
'compare_thread_library'
:
compare_threads_library
,
'compare_couvreur_algorithm'
:
compare_couvreur_strategies
,
'compare_tools'
:
compare_tools
,
'compare_multicore'
:
compare_multithreading
}
```
%% Cell type:markdown id: tags:
# Load Data
%% Cell type:code id: tags:
```
python
# Root folder
PROJECT_FOLDER
=
os
.
path
.
abspath
(
os
.
pardir
)
# csv file with the output
csv_file
=
os
.
path
.
join
(
PROJECT_FOLDER
,
"results"
,
"output.csv"
)
# Output folder
OUTPUT_FOLDER
=
os
.
path
.
join
(
PROJECT_FOLDER
,
"results"
,
"figures"
)
create_folder
(
OUTPUT_FOLDER
)
```
%% Cell type:code id: tags:
```
python
# read data
df
=
pd
.
read_csv
(
csv_file
)
# merge the information related to the experiment (# nodes, # threads, strategy) to the tool column
df
[
'tool'
]
=
df
[[
'tool'
,
'strategy'
,
'num_nodes'
,
'num_threads'
]].
astype
(
str
).
apply
(
'_'
.
join
,
axis
=
1
)
df
=
df
.
drop
(
columns
=
[
'strategy'
,
'num_nodes'
,
'num_threads'
])
df
.
head
()
```
%% Output
model formula tool time property error
0 philo10 1 pmc-sog_otfL_couv99-default_1_1 59.017 F OK
1 philo10 1 pmc-sog_otfL_couv99-default_1_8 11.856 F OK
2 philo10 1 pmc-sog_otfL_couv99-default_1_12 8.421 F OK
3 philo10 1 pmc-sog_otfL_couv99-default_1_16 6.552 F OK
4 philo10 1 pmc-sog_otfL_couv99-default_1_20 5.413 F OK
%% Cell type:code id: tags:
```
python
# ground truth for properties
p_df
=
pd
.
read_csv
(
csv_file
)
p_df
=
p_df
[
(
p_df
.
tool
==
'pnml2lts-mc'
)
&
(
p_df
.
strategy
==
'ndfs'
)
&
(
p_df
.
num_nodes
==
1
)
&
(
p_df
.
num_threads
==
1
)]
# only property column is needed
p_df
=
p_df
.
drop
(
columns
=
[
'tool'
,
'strategy'
,
'num_nodes'
,
'num_threads'
,
'time'
,
'error'
])
p_df
.
fillna
(
'U'
,
inplace
=
True
)
p_df
.
set_index
([
'model'
,
'formula'
],
inplace
=
True
)
p_df
.
sort_index
(
inplace
=
True
)
p_df
.
head
()
```
%% Output
property
model formula
philo10 1 F
2 F
3 F
4 F
5 F
%% Cell type:code id: tags:
```
python
# table with times, verification output and error for each experiment
table
=
df
.
set_index
([
'model'
,
'formula'
,
'tool'
],
drop
=
True
).
unstack
(
'tool'
)
table
.
head
()
```
%% Output
time \
tool pmc-sog_otfL_couv99-default_1_1
model formula
philo10 1 59.017
2 25.394
3 NaN
4 NaN
5 34.287
\
tool pmc-sog_otfL_couv99-default_1_12
model formula
philo10 1 8.421
2 4.064
3 NaN
4 NaN
5 5.484
\
tool pmc-sog_otfL_couv99-default_1_16
model formula
philo10 1 6.552
2 3.134
3 NaN
4 NaN
5 4.257
\
tool pmc-sog_otfL_couv99-default_1_20
model formula
philo10 1 5.413
2 2.586
3 NaN
4 NaN
5 3.541
\
tool pmc-sog_otfL_couv99-default_1_8 pmc-sog_otfL_couv99-shy_1_1
model formula
philo10 1 11.856 46.157
2 5.639 41.311
3 NaN NaN
4 NaN NaN
5 7.612 55.165
\
tool pmc-sog_otfL_couv99-shy_1_12 pmc-sog_otfL_couv99-shy_1_16
model formula
philo10 1 7.477 5.732
2 6.367 5.006
3 NaN NaN
4 NaN NaN
5 9.004 6.980
... \
tool pmc-sog_otfL_couv99-shy_1_20 pmc-sog_otfL_couv99-shy_1_8 ...
model formula ...
philo10 1 4.728 10.394 ...
2 4.125 8.907 ...
3 NaN NaN ...
4 NaN NaN ...
5 5.767 12.671 ...
error \
tool pnml2lts-mc_dfs_1_16 pnml2lts-mc_dfs_1_20
model formula
philo10 1 OK OK
2 OK OK
3 OK OK
4 OK OK
5 OK OK
\
tool pnml2lts-mc_dfs_1_40 pnml2lts-mc_dfs_1_8 pnml2lts-mc_ndfs_1_1
model formula
philo10 1 NaN OK OK
2 NaN OK OK
3 NaN OK OK
4 NaN OK OK
5 NaN OK OK
\
tool pnml2lts-mc_ndfs_1_12 pnml2lts-mc_ndfs_1_16
model formula
philo10 1 OK OK
2 OK OK
3 OK OK
4 OK OK
5 OK OK
\
tool pnml2lts-mc_ndfs_1_20 pnml2lts-mc_ndfs_1_40
model formula
philo10 1 OK NaN
2 OK NaN
3 OK NaN
4 OK NaN
5 OK NaN
tool pnml2lts-mc_ndfs_1_8
model formula
philo10 1 OK
2 OK
3 OK
4 OK
5 OK
[5 rows x 144 columns]
%% Cell type:markdown id: tags:
# Preprocessing of data
%% Cell type:code id: tags:
```
python
ZERO
=
10e-5
TIMEOUT
=
3
*
60
#
3
minutes =
18
0 seconds
TIMEOUT
=
5
*
60
#
5
minutes =
30
0 seconds
```
%% Cell type:code id: tags:
```
python
# table with times for each experiment
table_time
=
table
[
'time'
].
copy
()
# replace non finished experiments with a dummy value, e.g. timeout
table_time
.
fillna
(
TIMEOUT
,
inplace
=
True
)
# replace 0.00 time for 10^(-5), we cannot plot log(0)
table_time
.
replace
(
0.0
,
ZERO
,
inplace
=
True
)
# add verification output to the table
table_time
=
pd
.
concat
([
table_time
,
p_df
],
axis
=
1
)
table_time
.
head
()
```
%% Output
pmc-sog_otfL_couv99-default_1_1 \
model formula
philo10 1 59.017
2 25.394
3 180.000
4 180.000
5 34.287
pmc-sog_otfL_couv99-default_1_12 \
model formula
philo10 1 8.421
2 4.064
3 180.000
4 180.000
5 5.484
pmc-sog_otfL_couv99-default_1_16 \
model formula
philo10 1 6.552
2 3.134
3 180.000
4 180.000
5 4.257
pmc-sog_otfL_couv99-default_1_20 \
model formula
philo10 1 5.413
2 2.586
3 180.000
4 180.000
5 3.541
pmc-sog_otfL_couv99-default_1_8 pmc-sog_otfL_couv99-shy_1_1 \
model formula
philo10 1 11.856 46.157
2 5.639 41.311
3 180.000 180.000
4 180.000 180.000
5 7.612 55.165
pmc-sog_otfL_couv99-shy_1_12 pmc-sog_otfL_couv99-shy_1_16 \
model formula
philo10 1 7.477 5.732
2 6.367 5.006
3 180.000 180.000
4 180.000 180.000
5 9.004 6.980
pmc-sog_otfL_couv99-shy_1_20 pmc-sog_otfL_couv99-shy_1_8 \
model formula
philo10 1 4.728 10.394
2 4.125 8.907
3 180.000 180.000
4 180.000 180.000
5 5.767 12.671
... pnml2lts-mc_dfs_1_20 pnml2lts-mc_dfs_1_40 \
model formula ...
philo10 1 ... 0.78 180.0
2 ... 0.63 180.0
3 ... 1.24 180.0
4 ... 0.72 180.0
5 ... 0.72 180.0
pnml2lts-mc_dfs_1_8 pnml2lts-mc_ndfs_1_1 \
model formula
philo10 1 1.39 0.29
2 1.09 0.20
3 2.56 0.63
4 1.26 0.47
5 1.30 0.14
pnml2lts-mc_ndfs_1_12 pnml2lts-mc_ndfs_1_16 \
model formula
philo10 1 0.13 0.12
2 0.09 0.09
3 0.12 0.10
4 0.10 0.14
5 0.06 0.07
pnml2lts-mc_ndfs_1_20 pnml2lts-mc_ndfs_1_40 \
model formula
philo10 1 0.13 180.0
2 0.08 180.0
3 0.11 180.0
4 0.14 180.0
5 0.08 180.0
pnml2lts-mc_ndfs_1_8 property
model formula
philo10 1 0.19 F
2 0.10 F
3 0.12 F
4 0.12 F
5 0.08 F
[5 rows x 49 columns]
%% Cell type:code id: tags:
```
python
# table with verification output for each experiment
table_property
=
table
[
'property'
].
copy
()
# replace non finished experiments with a dummy value
table_property
.
fillna
(
'U'
,
inplace
=
True
)
# add ground truth to the table
table_property
=
pd
.
concat
([
table_property
,
p_df
],
axis
=
1
)
table_property
.
head
()
```
%% Output
pmc-sog_otfL_couv99-default_1_1 \
model formula
philo10 1 F
2 F
3 U
4 U
5 F
pmc-sog_otfL_couv99-default_1_12 \
model formula
philo10 1 F
2 F
3 U
4 U
5 F
pmc-sog_otfL_couv99-default_1_16 \
model formula
philo10 1 F
2 F
3 U
4 U
5 F
pmc-sog_otfL_couv99-default_1_20 \
model formula
philo10 1 F
2 F
3 U
4 U
5 F
pmc-sog_otfL_couv99-default_1_8 pmc-sog_otfL_couv99-shy_1_1 \
model formula
philo10 1 F F
2 F F
3 U U
4 U U
5 F F
pmc-sog_otfL_couv99-shy_1_12 pmc-sog_otfL_couv99-shy_1_16 \
model formula
philo10 1 F F
2 F F
3 U U
4 U U
5 F F
pmc-sog_otfL_couv99-shy_1_20 pmc-sog_otfL_couv99-shy_1_8 ... \
model formula ...
philo10 1 F F ...
2 F F ...
3 U U ...
4 U U ...
5 F F ...
pnml2lts-mc_dfs_1_20 pnml2lts-mc_dfs_1_40 pnml2lts-mc_dfs_1_8 \
model formula
philo10 1 U U U
2 U U U
3 U U U
4 U U U
5 U U U
pnml2lts-mc_ndfs_1_1 pnml2lts-mc_ndfs_1_12 \
model formula
philo10 1 F F
2 F F
3 F F
4 F F
5 F F
pnml2lts-mc_ndfs_1_16 pnml2lts-mc_ndfs_1_20 \
model formula
philo10 1 F F
2 F F
3 F F
4 F F
5 F F
pnml2lts-mc_ndfs_1_40 pnml2lts-mc_ndfs_1_8 property
model formula
philo10 1 U F F
2 U F F
3 U F F
4 U F F
5 U F F
[5 rows x 49 columns]
%% Cell type:code id: tags:
```
python
# table with error for each experiment
table_error
=
table
[
'error'
].
copy
()
table_error
.
head
()
```
%% Output
tool pmc-sog_otfL_couv99-default_1_1 \
model formula
philo10 1 OK
2 OK
3 TERMINATE
4 TERMINATE
5 OK
tool pmc-sog_otfL_couv99-default_1_12 \
model formula
philo10 1 OK
2 OK
3 TERMINATE
4 TERMINATE
5 OK
tool pmc-sog_otfL_couv99-default_1_16 \
model formula
philo10 1 OK
2 OK
3 TERMINATE
4 TERMINATE
5 OK
tool pmc-sog_otfL_couv99-default_1_20 \
model formula
philo10 1 OK
2 OK
3 TERMINATE
4 TERMINATE
5 OK
tool pmc-sog_otfL_couv99-default_1_8 pmc-sog_otfL_couv99-shy_1_1 \
model formula
philo10 1 OK OK
2 OK OK
3 TERMINATE TERMINATE
4 TERMINATE TERMINATE
5 OK OK
tool pmc-sog_otfL_couv99-shy_1_12 pmc-sog_otfL_couv99-shy_1_16 \
model formula
philo10 1 OK OK
2 OK OK
3 TERMINATE TERMINATE
4 TERMINATE TERMINATE
5 OK OK
tool pmc-sog_otfL_couv99-shy_1_20 pmc-sog_otfL_couv99-shy_1_8 ... \
model formula ...
philo10 1 OK OK ...
2 OK OK ...
3 TERMINATE TERMINATE ...
4 TERMINATE TERMINATE ...
5 OK OK ...
tool pnml2lts-mc_dfs_1_16 pnml2lts-mc_dfs_1_20 \
model formula
philo10 1 OK OK
2 OK OK
3 OK OK
4 OK OK
5 OK OK
tool pnml2lts-mc_dfs_1_40 pnml2lts-mc_dfs_1_8 pnml2lts-mc_ndfs_1_1 \
model formula
philo10 1 NaN OK OK
2 NaN OK OK
3 NaN OK OK
4 NaN OK OK
5 NaN OK OK
tool pnml2lts-mc_ndfs_1_12 pnml2lts-mc_ndfs_1_16 \
model formula
philo10 1 OK OK
2 OK OK
3 OK OK
4 OK OK
5 OK OK
tool pnml2lts-mc_ndfs_1_20 pnml2lts-mc_ndfs_1_40 \
model formula
philo10 1 OK NaN
2 OK NaN
3 OK NaN
4 OK NaN
5 OK NaN
tool pnml2lts-mc_ndfs_1_8
model formula
philo10 1 OK
2 OK
3 OK
4 OK
5 OK
[5 rows x 48 columns]
%% Cell type:markdown id: tags:
# Examples
%% Cell type:code id: tags:
```
python
fig
=
create_figure
(
df
,
"philo10"
)
fig
.
show
()
```
%% Output
%% Cell type:code id: tags:
```
python
fig
=
create_log_figure
(
table_time
,
table_error
,
"train12"
,
"pmc-sog_otfP_couv99-default_1_8"
,
"pnml2lts-mc_dfs_1_8"
)
fig
.
show
()
```
%% Output
%% Cell type:markdown id: tags:
# Generate Figures
%% Cell type:code id: tags:
```
python
# models
models
=
df
.
model
.
unique
()
# tools
tools
=
df
.
tool
.
unique
()
```
%% Cell type:code id: tags:
```
python
# create all the figures formula vs time
folder
=
os
.
path
.
join
(
OUTPUT_FOLDER
,
'time-plots'
)
create_folder
(
folder
)
for
model
in
models
:
try
:
fig
=
create_figure
(
df
,
model
)
# save figures in html and pdf
fig
.
write_html
(
os
.
path
.
join
(
folder
,
model
+
'.html'
))
fig
.
write_image
(
os
.
path
.
join
(
folder
,
model
+
'.pdf'
))
except
KeyError
:
print
(
"Error: {} was not plotted"
.
format
(
model
))
```
%% Cell type:code id: tags:
```
python
# create all the log figures
tools_pairs
=
list
(
combinations
(
tools
,
2
))
for
plot
,
filter_method
in
plots
.
items
():
axes
=
list
(
filter
(
filter_method
,
tools_pairs
))
for
model
in
models
:
folder
=
os
.
path
.
join
(
OUTPUT_FOLDER
,
plot
,
model
)
create_folder
(
folder
)
for
axe
in
axes
:
try
:
show_strategy
=
plot
==
'compare_couvreur_algorithm'
fig
=
create_log_figure
(
table_time
,
table_error
,
model
,
axe
[
0
],
axe
[
1
],
show_strategy
)
# save figures in html and pdf
figure_name
=
os
.
path
.
join
(
folder
,
'{}-{}-VS-{}-log'
.
format
(
model
,
axe
[
0
],
axe
[
1
]))
fig
.
write_html
(
figure_name
+
'.html'
)
fig
.
write_image
(
figure_name
+
'.pdf'
)
except
KeyError
:
print
(
"Error: {} was not plotted"
.
format
(
model
))
```
%% Cell type:code id: tags:
```
python
```
...
...
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