From e1b1652483d9bd46542944e5588729f27af1df91 Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Fri, 11 Oct 2019 03:39:54 +0200 Subject: [PATCH 1/2] extended --- examples/40_paper/2018_ida_strang_example.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/40_paper/2018_ida_strang_example.py b/examples/40_paper/2018_ida_strang_example.py index 70ed51ba2..3c836f081 100644 --- a/examples/40_paper/2018_ida_strang_example.py +++ b/examples/40_paper/2018_ida_strang_example.py @@ -98,3 +98,15 @@ def determine_class(val_lin, val_nonlin): ax_scatter.set_xscale('log') ax_scatter.set_yscale('log') plt.show() + +# makes a scatter plot where each data point represents the performance of the two algorithms on various axis +# (not in the paper) +fig_diagplot, ax_diagplot = plt.subplots() +ax_diagplot.grid(linestyle='--') +ax_diagplot.plot([0, 1], ls="-", color="black") +ax_diagplot.plot([0.2, 1.2], ls="--", color="black") +ax_diagplot.plot([-0.2, 0.8], ls="--", color="black") +ax_diagplot.scatter(evaluations[flow_ids[0]], evaluations[flow_ids[1]]) +ax_diagplot.set_xlabel(measure) +ax_diagplot.set_ylabel(measure) +plt.show() From 9041dc612285e97ddf861500d7b7a58beef892db Mon Sep 17 00:00:00 2001 From: janvanrijn Date: Fri, 11 Oct 2019 17:18:06 +0200 Subject: [PATCH 2/2] strang example update --- examples/40_paper/2018_ida_strang_example.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/examples/40_paper/2018_ida_strang_example.py b/examples/40_paper/2018_ida_strang_example.py index 3c836f081..ef35a4a21 100644 --- a/examples/40_paper/2018_ida_strang_example.py +++ b/examples/40_paper/2018_ida_strang_example.py @@ -61,7 +61,10 @@ # adds column that indicates the difference between the two classifiers evaluations['diff'] = evaluations[flow_ids[0]] - evaluations[flow_ids[1]] + +############################################################################## # makes the s-plot + fig_splot, ax_splot = plt.subplots() ax_splot.plot(range(len(evaluations)), sorted(evaluations['diff'])) ax_splot.set_title(classifier_family) @@ -71,7 +74,10 @@ plt.show() -# adds column that indicates the difference between the two classifiers +############################################################################## +# adds column that indicates the difference between the two classifiers, +# needed for the scatter plot + def determine_class(val_lin, val_nonlin): if val_lin < val_nonlin: return class_values[0] @@ -84,7 +90,7 @@ def determine_class(val_lin, val_nonlin): evaluations['class'] = evaluations.apply( lambda row: determine_class(row[flow_ids[0]], row[flow_ids[1]]), axis=1) -# makes the scatter plot +# does the plotting and formatting fig_scatter, ax_scatter = plt.subplots() for class_val in class_values: df_class = evaluations[evaluations['class'] == class_val] @@ -99,8 +105,10 @@ def determine_class(val_lin, val_nonlin): ax_scatter.set_yscale('log') plt.show() -# makes a scatter plot where each data point represents the performance of the two algorithms on various axis -# (not in the paper) +############################################################################## +# makes a scatter plot where each data point represents the performance of the +# two algorithms on various axis (not in the paper) + fig_diagplot, ax_diagplot = plt.subplots() ax_diagplot.grid(linestyle='--') ax_diagplot.plot([0, 1], ls="-", color="black")