Skip to content

Commit 9041dc6

Browse files
committed
strang example update
1 parent e1b1652 commit 9041dc6

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

examples/40_paper/2018_ida_strang_example.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@
6161
# adds column that indicates the difference between the two classifiers
6262
evaluations['diff'] = evaluations[flow_ids[0]] - evaluations[flow_ids[1]]
6363

64+
65+
##############################################################################
6466
# makes the s-plot
67+
6568
fig_splot, ax_splot = plt.subplots()
6669
ax_splot.plot(range(len(evaluations)), sorted(evaluations['diff']))
6770
ax_splot.set_title(classifier_family)
@@ -71,7 +74,10 @@
7174
plt.show()
7275

7376

74-
# adds column that indicates the difference between the two classifiers
77+
##############################################################################
78+
# adds column that indicates the difference between the two classifiers,
79+
# needed for the scatter plot
80+
7581
def determine_class(val_lin, val_nonlin):
7682
if val_lin < val_nonlin:
7783
return class_values[0]
@@ -84,7 +90,7 @@ def determine_class(val_lin, val_nonlin):
8490
evaluations['class'] = evaluations.apply(
8591
lambda row: determine_class(row[flow_ids[0]], row[flow_ids[1]]), axis=1)
8692

87-
# makes the scatter plot
93+
# does the plotting and formatting
8894
fig_scatter, ax_scatter = plt.subplots()
8995
for class_val in class_values:
9096
df_class = evaluations[evaluations['class'] == class_val]
@@ -99,8 +105,10 @@ def determine_class(val_lin, val_nonlin):
99105
ax_scatter.set_yscale('log')
100106
plt.show()
101107

102-
# makes a scatter plot where each data point represents the performance of the two algorithms on various axis
103-
# (not in the paper)
108+
##############################################################################
109+
# makes a scatter plot where each data point represents the performance of the
110+
# two algorithms on various axis (not in the paper)
111+
104112
fig_diagplot, ax_diagplot = plt.subplots()
105113
ax_diagplot.grid(linestyle='--')
106114
ax_diagplot.plot([0, 1], ls="-", color="black")

0 commit comments

Comments
 (0)