Commit 91dc92ca authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

[script][figure] Remove filenames in plots, but use them in log info

parent 2c95991f
Pipeline #21448 passed with stage
in 30 minutes and 43 seconds
...@@ -97,6 +97,17 @@ class MeasureBase(object): ...@@ -97,6 +97,17 @@ class MeasureBase(object):
# index idx * self._min_arg # index idx * self._min_arg
self._scores[idx * self._min_arg:(idx + 1) * self._min_arg] self._scores[idx * self._min_arg:(idx + 1) * self._min_arg]
) )
LOGGER.info("-----Input files for system %d-----", idx + 1)
for i, name in enumerate(input_names):
if not self._eval:
LOGGER.info("Dev. score %d: %s", i + 1, name)
else:
if i % 2 == 0:
LOGGER.info("Dev. score %d: %s", i / 2 + 1, name)
else:
LOGGER.info("Eval. score %d: %s", i / 2 + 1, name)
LOGGER.info("----------------------------------")
self.compute(idx, input_scores, input_names) self.compute(idx, input_scores, input_names)
# setup final configuration, plotting properties, ... # setup final configuration, plotting properties, ...
self.end_process() self.end_process()
...@@ -151,12 +162,12 @@ class MeasureBase(object): ...@@ -151,12 +162,12 @@ class MeasureBase(object):
A list that contains the output of A list that contains the output of
``func_load`` for the given files ``func_load`` for the given files
basenames: :any:`list`: basenames: :any:`list`:
A list of basenames for the given files A list of the given files
''' '''
scores = [] scores = []
basenames = [] basenames = []
for filename in filepaths: for filename in filepaths:
basenames.append(os.path.basename(filename).split(".")[0]) basenames.append(filename.split(".")[0])
scores.append(self.func_load(filename)) scores.append(self.func_load(filename))
return scores, basenames return scores, basenames
...@@ -504,12 +515,12 @@ class PlotBase(MeasureBase): ...@@ -504,12 +515,12 @@ class PlotBase(MeasureBase):
# common protected functions # common protected functions
def _label(self, base, name, idx): def _label(self, base, idx):
if self._legends is not None and len(self._legends) > idx: if self._legends is not None and len(self._legends) > idx:
return self._legends[idx] return self._legends[idx]
if self.n_systems > 1: if self.n_systems > 1:
return base + (" %d (%s)" % (idx + 1, name)) return base + (" %d" % (idx + 1))
return base + (" (%s)" % name) return base
def _set_axis(self): def _set_axis(self):
if self._axlim is not None: if self._axlim is not None:
...@@ -543,23 +554,25 @@ class Roc(PlotBase): ...@@ -543,23 +554,25 @@ class Roc(PlotBase):
mpl.figure(1) mpl.figure(1)
if self._eval: if self._eval:
LOGGER.info("ROC dev. curve using %s", dev_file)
plot.roc_for_far( plot.roc_for_far(
dev_neg, dev_pos, dev_neg, dev_pos,
far_values=plot.log_values(self._min_dig or -4), far_values=plot.log_values(self._min_dig or -4),
CAR=self._semilogx, CAR=self._semilogx,
color=self._colors[idx], linestyle=self._linestyles[idx], color=self._colors[idx], linestyle=self._linestyles[idx],
label=self._label('dev', dev_file, idx) label=self._label('dev', idx)
) )
if self._split: if self._split:
mpl.figure(2) mpl.figure(2)
linestyle = '--' if not self._split else self._linestyles[idx] linestyle = '--' if not self._split else self._linestyles[idx]
LOGGER.info("ROC eval. curve using %s", eval_file)
plot.roc_for_far( plot.roc_for_far(
eval_neg, eval_pos, linestyle=linestyle, eval_neg, eval_pos, linestyle=linestyle,
far_values=plot.log_values(self._min_dig or -4), far_values=plot.log_values(self._min_dig or -4),
CAR=self._semilogx, CAR=self._semilogx,
color=self._colors[idx], color=self._colors[idx],
label=self._label('eval.', eval_file, idx) label=self._label('eval.', idx)
) )
if self._far_at is not None: if self._far_at is not None:
from .. import farfrr from .. import farfrr
...@@ -571,12 +584,13 @@ class Roc(PlotBase): ...@@ -571,12 +584,13 @@ class Roc(PlotBase):
mpl.scatter(eval_fmr, eval_fnmr, c=self._colors[idx], s=30) mpl.scatter(eval_fmr, eval_fnmr, c=self._colors[idx], s=30)
self._eval_points[line].append((eval_fmr, eval_fnmr)) self._eval_points[line].append((eval_fmr, eval_fnmr))
else: else:
LOGGER.info("ROC dev. curve using %s", dev_file)
plot.roc_for_far( plot.roc_for_far(
dev_neg, dev_pos, dev_neg, dev_pos,
far_values=plot.log_values(self._min_dig or -4), far_values=plot.log_values(self._min_dig or -4),
CAR=self._semilogx, CAR=self._semilogx,
color=self._colors[idx], linestyle=self._linestyles[idx], color=self._colors[idx], linestyle=self._linestyles[idx],
label=self._label('dev', dev_file, idx) label=self._label('dev', idx)
) )
...@@ -613,18 +627,20 @@ class Det(PlotBase): ...@@ -613,18 +627,20 @@ class Det(PlotBase):
mpl.figure(1) mpl.figure(1)
if self._eval and eval_neg is not None: if self._eval and eval_neg is not None:
LOGGER.info("DET dev. curve using %s", dev_file)
plot.det( plot.det(
dev_neg, dev_pos, self._points, color=self._colors[idx], dev_neg, dev_pos, self._points, color=self._colors[idx],
linestyle=self._linestyles[idx], linestyle=self._linestyles[idx],
label=self._label('dev.', dev_file, idx) label=self._label('dev.', idx)
) )
if self._split: if self._split:
mpl.figure(2) mpl.figure(2)
linestyle = '--' if not self._split else self._linestyles[idx] linestyle = '--' if not self._split else self._linestyles[idx]
LOGGER.info("DET eval. curve using %s", eval_file)
plot.det( plot.det(
eval_neg, eval_pos, self._points, color=self._colors[idx], eval_neg, eval_pos, self._points, color=self._colors[idx],
linestyle=linestyle, linestyle=linestyle,
label=self._label('eval.', eval_file, idx) label=self._label('eval.', idx)
) )
if self._far_at is not None: if self._far_at is not None:
from .. import farfrr from .. import farfrr
...@@ -636,10 +652,11 @@ class Det(PlotBase): ...@@ -636,10 +652,11 @@ class Det(PlotBase):
mpl.scatter(eval_fmr, eval_fnmr, c=self._colors[idx], s=30) mpl.scatter(eval_fmr, eval_fnmr, c=self._colors[idx], s=30)
self._eval_points[line].append((eval_fmr, eval_fnmr)) self._eval_points[line].append((eval_fmr, eval_fnmr))
else: else:
LOGGER.info("DET dev. curve using %s", dev_file)
plot.det( plot.det(
dev_neg, dev_pos, self._points, color=self._colors[idx], dev_neg, dev_pos, self._points, color=self._colors[idx],
linestyle=self._linestyles[idx], linestyle=self._linestyles[idx],
label=self._label('dev.', dev_file, idx) label=self._label('dev.', idx)
) )
def _set_axis(self): def _set_axis(self):
...@@ -671,11 +688,12 @@ class Epc(PlotBase): ...@@ -671,11 +688,12 @@ class Epc(PlotBase):
eval_neg, eval_pos = neg_list[1], pos_list[1] eval_neg, eval_pos = neg_list[1], pos_list[1]
eval_file = input_names[1] eval_file = input_names[1]
LOGGER.info("EPC using %s", dev_file + "_" + eval_file)
plot.epc( plot.epc(
dev_neg, dev_pos, eval_neg, eval_pos, self._points, dev_neg, dev_pos, eval_neg, eval_pos, self._points,
color=self._colors[idx], linestyle=self._linestyles[idx], color=self._colors[idx], linestyle=self._linestyles[idx],
label=self._label( label=self._label(
'curve', dev_file + "_" + eval_file, idx 'curve', idx
) )
) )
......
Markdown is supported
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