rankeval.visualization package — RankEval 0.00 documentation

# rankeval.visualization package

## Submodules

## rankeval.visualization.effectiveness module

This package provides visualizations for several effectiveness analysis focused on assessing the performance of the models in terms of accuracy.

`rankeval.visualization.effectiveness.` `init_plot_style`()

  Initialize plot style for RankEval visualization utilities. Returns ——-

`rankeval.visualization.effectiveness.` `is_log_scale_matrix`(matrix)

  This method receives in input a matrix created as performance.sel(dataset=X, model=Y) with li and lj as axes.

  In case the first values is at least 2 times bigger than the second values, we return True and the matrix will be rescaled in plot_rank_confusion_matrix by applying log2; otherwise we return False and nothing happens.

  matrix : xarray
    created as performance.sel(dataset=X, model=Y) with li and lj as axes
  : bool
    True or False

`rankeval.visualization.effectiveness.` `plot_document_graded_relevance`(performance)

  This method plots the results obtained from the document_graded_relevance analysis.

  performance: xarray
    The xarray obtained after computing document_graded_relevance.
  fig_list : list
    The list of figures.

`rankeval.visualization.effectiveness.` `plot_model_performance`(performance, compare='models', show_values=False)

  This method plots the results obtained from the model_performance analysis.

  performance: xarray
    The xarray obtained after computing model_performance.
  compare: string
    The compare parameter indicates what elements to compare between each other. Accepted values are ‘models’ or ‘metrics’.
  show_values: bool
    If show values is True, we add numeric labels on each bar in the plot with the rounded value to which the bar corresponds. The default is False and shows no values on the bars.
  fig_list : list
    The list of figures.

`rankeval.visualization.effectiveness.` `plot_query_class_performance`(performance, show_values=False, compare='models')

  This method plots the results obtained from the query_class_performance analysis.

  performance: xarray
    The xarray obtained after computing query_class_performance.
  compare: string
    The compare parameter indicates what elements to compare between each other. Accepted values are ‘models’ or ‘metrics’.
  show_values: bool
    If show values is True, we add numeric labels on each bar in the plot with the rounded value to which the bar corresponds. The default is False and shows no values on the bars.
  fig_list : list
    The list of figures.

`rankeval.visualization.effectiveness.` `plot_query_wise_performance`(performance, compare='models')

  This method plots the results obtained from the query_wise_performance analysis.

  performance: xarray
    The xarray obtained after computing query_wise_performance.
  compare: string
    The compare parameter indicates what elements to compare between each other. Accepted values are ‘models’ or ‘metrics’.
  fig_list : list
    The list of figures.

`rankeval.visualization.effectiveness.` `plot_rank_confusion_matrix`(performance)

  This method plots the results obtained from the rank_confusion_matrix analysis.

  performance: xarray
    The xarray obtained after computing rank_confusion_matrix.
  fig_list : list
    The list of figures.

`rankeval.visualization.effectiveness.` `plot_tree_wise_average_contribution`(performance)

  This method plots the results obtained from the tree_wise_average_contribution analysis.

  performance: xarray
    The xarray obtained after computing tree_wise_average_contribution.
  fig_list : list
    The list of figures.

`rankeval.visualization.effectiveness.` `plot_tree_wise_performance`(performance, compare='models')

  This method plots the results obtained from the tree_wise_performance analysis.

  performance: xarray
    The xarray obtained after computing tree_wise_performance.
  compare: string
    The compare parameter indicates what elements to compare between each other. The default is ‘models’. Accepted values are ‘models’ or ‘metrics’ or ‘datasets’.
  fig_list : list
    The list of figures.

## rankeval.visualization.feature module

This package provides support for feature analysis visualizations.

`rankeval.visualization.feature.` `align_y_axis`(ax1, ax2, minresax1, minresax2, num_ticks=7)

  Sets tick marks of twinx axes to line up with num_ticks total tick marks

  ax1 and ax2 are matplotlib axes Spacing between tick marks will be a factor of minresax1 and minresax2

`rankeval.visualization.feature.` `plot_feature_importance`(feature_perf, max_features=10, sort_by='gain', feature_names=None)

  Shows the most important features as a bar plot.

  feature_perf : xarray.DataArray
    Feature importance stats of the model to be visualized
  max_features : int or None
    Maximul number of features to be visualized. If None is passed, it will show all the features
  sort_by : ‘gain’ or ‘count’
    The method to use for selecting the top features to display. ‘gain’ method selects the top features by importance, ‘count’ selects the top features by usage (i.e., number of times it has been used by a split node).
  feature_names : list of string
    The name of the features to use for plotting. If None, their index is used in place of the name (starting from 1).
  : matplotlib.figure.Figure
    The matpotlib Figure

## rankeval.visualization.topological module

This package provides support for topological analysis visualizations.

`rankeval.visualization.topological.` `export_graphviz`(ensemble, tree_id=0, out_file=None, max_depth=None, output_leaves=None, label='all', label_show=False, feature_names=None, highlight_leaves=False, leaves_parallel=False, node_ids=False, rounded=False, proportion=False, special_characters=False, precision=3)

  Export a single decision tree in DOT format. This function generates a GraphViz representation of the decision tree, which is then written into out_file. Once exported, graphical renderings can be generated using, for example:

      $ dot -Tps tree.dot -o tree.ps      (PostScript format)
      $ dot -Tpng tree.dot -o tree.png    (PNG format)

  ensemble : RTEnsemble of regression trees
    The ensemble of regression trees to be exported to GraphViz.
  tree_id : int (default 0)
    The tree identifier in the ensemble to export (starts from 0)
  out_file : file object or string, optional (default=None)
    Handle or name of the output file. If `None`, the result is returned as a string.
  max_depth : int, optional (default=None)
    The maximum depth of the representation. If None, the tree is fully generated.
  output_leaves : numpy 2d array (default=None
    Output leaves computed while scoring this model on a given dataset using the score method of the RTEnsemble model (the third return variable, y_leaves, reports the output leaf of each dataset sample for each tree).
  label : {‘all’, ‘leaves’}, optional (default=’all’)
    Whether to compute the counts of dataset samples that during the scoring touched a specific node (i.e., how many times each node have been involved in the scoring activity, on a specific dataset). Options include ‘all’ to compute counts at every node or ‘leaves’ to compute it only on the leaf nodes.
  label_show : bool, optional (default=False)
    When set to `True`, print counts information in each node.
  feature_names : list of strings, optional (default=None)
    Names of each of the features.
  highlight_leaves : bool, optional (default=False)
    When set to `True`, paint leaves to indicate extremity of values for regression.
  leaves_parallel : bool, optional (default=False)
    When set to `True`, draw all leaf nodes at the bottom of the tree.
  node_ids : bool, optional (default=False)
    When set to `True`, show the ID number on each node.
  rounded : bool, optional (default=False)
    When set to `True`, draw node boxes with rounded corners and use Helvetica fonts instead of Times-Roman.
  proportion : bool, optional (default=False)
    When set to `True`, change the display of ‘counts’ adding the percentages.
  special_characters : bool, optional (default=False)
    When set to `False`, ignore special characters for PostScript compatibility.
  precision : int, optional (default=3)
    Number of digits of precision for floating point in the values of impurity, threshold and value attributes of each node.
  dot_data : string
    String representation of the input tree in GraphViz dot format. Only returned if `out_file` is None.

`rankeval.visualization.topological.` `plot_shape`(topological, max_level=10)

  Shows the average tree shape as a bullseye plot.

  topological : TopologicalAnalysisResult
    Topological stats of the model to be visualized.
  max_level : int
    Maximul tree-depth of the visualization. Maximum allowed value is 16.
  : matplotlib.figure.Figure
    The matpotlib Figure

`rankeval.visualization.topological.` `plot_tree`(dot_data)