Skip to content
Snippets Groups Projects

Separate semilogx and TPR options in ROC plots

Merged Amir MOHAMMADI requested to merge roc-semilogx-tpr into master
6 unresolved threads

Also, ran black on some code files.

Edited by Amir MOHAMMADI

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
566 802 def x_label_option(dflt=None, **kwargs):
567 '''Get the label option for X axis '''
803 """Get the label option for X axis """
804
568 805 def custom_x_label_option(func):
569 806 def callback(ctx, param, value):
570 ctx.meta['x_label'] = value
807 ctx.meta["x_label"] = value
571 808 return value
809
572 810 return click.option(
573 '-xl', '--x-lable', type=click.STRING, default=dflt,
574 show_default=True, help='Label for x-axis',
575 callback=callback, **kwargs)(func)
811 "-xl",
812 "--x-label",
  • 579 824 def y_label_option(dflt=None, **kwargs):
    580 '''Get the label option for Y axis '''
    825 """Get the label option for Y axis """
    826
    581 827 def custom_y_label_option(func):
    582 828 def callback(ctx, param, value):
    583 ctx.meta['y_label'] = value
    829 ctx.meta["y_label"] = value
    584 830 return value
    831
    585 832 return click.option(
    586 '-yl', '--y-lable', type=click.STRING, default=dflt,
    587 help='Label for y-axis',
    588 callback=callback, **kwargs)(func)
    833 "-yl",
    834 "--y-label",
  • 134 '''Option to use semilog X-axis'''
    135 return bool_option('semilogx', 'G', 'If set, use semilog on X axis', dflt,
    136 **kwargs)
    166 """Option to use semilog X-axis"""
    167 return bool_option("semilogx", "G", "If set, use semilog on X axis", dflt, **kwargs)
    168
    169
    170 def tpr_option(dflt=False, **kwargs):
    171 """Option to use TPR (true positive rate) on y-axis"""
    172 return bool_option(
    173 "tpr",
    174 "tpr",
    175 "If set, use TPR (also called 1-FNR, 1-FNMR, or 1-BPCER) on Y axis",
    176 dflt,
    177 **kwargs
    178 )
  • 664 926 @no_legend_option()
    665 927 @legend_loc_option(dflt=None)
    666 928 @sep_dev_eval_option()
    667 @output_plot_file_option(default_out='roc.pdf')
    929 @output_plot_file_option(default_out="roc.pdf")
    668 930 @eval_option()
    931 @tpr_option(True)
  • 553 ''' Handles the plotting of ROC'''
    627 """ Handles the plotting of ROC"""
    554 628
    555 629 def __init__(self, ctx, scores, evaluation, func_load):
    556 630 super(Roc, self).__init__(ctx, scores, evaluation, func_load)
    557 self._titles = self._titles or ['ROC dev.', 'ROC eval.']
    558 self._x_label = self._x_label or 'FPR'
    559 self._y_label = self._y_label or "1 - FNR"
    560 self._semilogx = ctx.meta.get('semilogx', True)
    561 best_legend = 'lower right' if self._semilogx else 'upper right'
    631 self._titles = self._titles or ["ROC dev.", "ROC eval."]
    632 self._x_label = self._x_label or "FPR"
    633 self._semilogx = ctx.meta.get("semilogx", True)
    634 self._tpr = ctx.meta.get("tpr", True)
    635 dflt_y_label = "TPR" if self._tpr else "FNR"
    636 self._y_label = self._y_label or dflt_y_label
  • 610 if self._semilogx:
    691 eval_fmr, eval_fnmr = fprfnr(eval_neg, eval_pos, thres_line)
    692 if self._tpr:
    611 693 eval_fnmr = 1 - eval_fnmr
    612 694 mpl.scatter(eval_fmr, eval_fnmr, c=self._colors[idx], s=30)
    613 695 self._eval_points[line].append((eval_fmr, eval_fnmr))
    614 696 else:
    615 697 LOGGER.info("ROC dev. curve using %s", dev_file)
    616 698 plot.roc(
    617 dev_neg, dev_pos,
    699 dev_neg,
    700 dev_pos,
    618 701 npoints=self._points,
    619 CAR=self._semilogx,
    702 semilogx=self._semilogx,
    703 tpr=self._tpr,
  • mentioned in merge request bob.bio.base!179 (merged)

  • mentioned in merge request bob.pad.base!65 (merged)

  • Amir MOHAMMADI mentioned in commit 23475f4f

    mentioned in commit 23475f4f

  • mentioned in issue bob#259 (closed)

  • Please register or sign in to reply
    Loading