Commit 16c21807 authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

ENH: optional limit to cumulative importance for plotting.

No related merge requests found
Showing with 2 additions and 2 deletions
+2 -2
......@@ -30,7 +30,7 @@ def parse_colormap_file(fn):
return labels, class_names, colors
def generate_report_figures(map, palette_fn, results, summary, out_dir, map_name=None):
def generate_report_figures(map, palette_fn, results, summary, out_dir, map_name=None, importance_perc=0.75):
labels, class_names, colors = parse_colormap_file(palette_fn)
colors_norm = [(x[0]/255,x[1]/255,x[2]/255,x[3]/255) for x in colors]
with plt.ioff():
......@@ -81,7 +81,7 @@ def generate_report_figures(map, palette_fn, results, summary, out_dir, map_name
imp_s = [x for _, x in sorted(zip(imp_m, imp_s), reverse=True)]
imp_m = sorted(imp_m, reverse=True)
c_imp = np.cumsum(imp_m)
idx = np.where(c_imp<0.75*c_imp[-1])[0][-1]
idx = np.where(c_imp<importance_perc * c_imp[-1])[0][-1]
imp_m = imp_m[:idx]
imp_s = imp_s[:idx]
imp_n = imp_n[:idx]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment