Plotter

src.utils.plotter.add_tag_2_path(tag, path)

Add a tag at the end of the name of the file in the given path

Parameters
  • suffix (str)

  • pathlib.Path – suffix to add to the filename

  • path (pathlib.Path) – A file name or a path to a file

src.utils.plotter.base_plot_roc(fpr, tpr, fpr0=None, tpr0=None, label='', path2figure=None, title='ROC curve')

Plots a ROC curve from two lists of fpr and tpr values

Parameters
  • fpr (array-like) – False positive rate values

  • tpr (array-like) – True positive rate values

  • fpr0 (float or None, optional (default=None)) – FPR of the operating point. If none no operation point is plotted

  • tpr0 (float or None, optional (default=None)) – TPR of the operating point. If none no operation point is plotted

  • label (str, optional (default=””)) – Label for the plot

  • path2figure (str or pathlib.Path or None) – Path to save the figure. If None, the figure is not saved

src.utils.plotter.plot_doc_scores(scores, n_pos=None, path2figure=None)

Plot sorted document scores

Parameters
  • scores (list) – A list of scores

  • n_pos (float, optional (default=None)) – The position to mark in the plot.

src.utils.plotter.plot_roc(roc, metrics, tag='', path2figure=None)

Plots a ROC curve from two data dictionaries.

Parameters
  • roc (dict) – A dictionary of roc values. It should containt heys fpr_roc, tpr_roc and auc

  • metrics (dict) – A dictionary of performance metrics. It should contain keys fpr0 and tpr0 (the point of operation)

  • tag (str, optional (default=””)) – Tipically, a label ‘Train’ or ‘Test’ to add to the figure texts

  • path2figure (str or pathlib.Path or None) – Path to save the figure. If None, the figure is not saved

src.utils.plotter.plot_top_values(stats, n_top=25, title='', xlabel='', ylabel='')

Barplots the top values in a given dictionary.

Parameters
  • stats (dict) – Dictionary of pairs string: number

  • n_top (int, optional (default=25)) – Maximun number of bins

  • title (str, optional (default=””)) – Title for the figure

  • xlabel (str, optional (default=””)) – xlabel for the figure

  • ylabel (str, optional (default=””)) – ylabel for the figure