6161# adds column that indicates the difference between the two classifiers
6262evaluations ['diff' ] = evaluations [flow_ids [0 ]] - evaluations [flow_ids [1 ]]
6363
64+
65+ ##############################################################################
6466# makes the s-plot
67+
6568fig_splot , ax_splot = plt .subplots ()
6669ax_splot .plot (range (len (evaluations )), sorted (evaluations ['diff' ]))
6770ax_splot .set_title (classifier_family )
7174plt .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+
7581def 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):
8490evaluations ['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
8894fig_scatter , ax_scatter = plt .subplots ()
8995for class_val in class_values :
9096 df_class = evaluations [evaluations ['class' ] == class_val ]
@@ -98,3 +104,17 @@ def determine_class(val_lin, val_nonlin):
98104ax_scatter .set_xscale ('log' )
99105ax_scatter .set_yscale ('log' )
100106plt .show ()
107+
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+
112+ fig_diagplot , ax_diagplot = plt .subplots ()
113+ ax_diagplot .grid (linestyle = '--' )
114+ ax_diagplot .plot ([0 , 1 ], ls = "-" , color = "black" )
115+ ax_diagplot .plot ([0.2 , 1.2 ], ls = "--" , color = "black" )
116+ ax_diagplot .plot ([- 0.2 , 0.8 ], ls = "--" , color = "black" )
117+ ax_diagplot .scatter (evaluations [flow_ids [0 ]], evaluations [flow_ids [1 ]])
118+ ax_diagplot .set_xlabel (measure )
119+ ax_diagplot .set_ylabel (measure )
120+ plt .show ()
0 commit comments