The Plot Methods

class eurybia.core.smartplotter.SmartPlotter(smartdrift)[source]

Bases: object

The smartplotter class includes all the methods used to display graphics

Each SmartPlotter method is easy to use from a Smart Drift object, just use the following syntax

smartdrift

SmartDrift object

Type

object

_palette_name

Name of the palette used for the colors of the report (refer to style folder).

Type

str (default: ‘eurybia’)

_style_dict

Dict contains dicts of the colors used in the different plots

Type

dict

Example

>>> SD = Smartdrift()
>>> SD.compile()
>>> SD.plot.my_plot_method(param=value)
generate_fig_univariate(col: str, hue: Optional[str] = None, df_all: Optional[pandas.core.frame.DataFrame] = None, dict_color_palette: Optional[dict] = None) matplotlib.figure.Figure[source]

Returns a plotly figure containing the distribution of any kind of feature (continuous, categorical).

If the feature is categorical and contains too many categories, the smallest categories are grouped into a new ‘Other’ category so that the graph remains readable.

The input dataframe should contain the column of interest and a column that is used to distinguish two types of values (ex. ‘train’ and ‘test’)

Parameters
  • df_all (pd.DataFrame) – The input dataframe that contains the column of interest

  • col (str) – The column of interest

  • hue (str) – The column used to distinguish the values (ex. ‘train’ and ‘test’)

  • type (str) – The type of the series (‘continous’ or ‘categorical’)

Return type

plotly.graph_objs._figure.Figure

generate_historical_datadrift_metric(datadrift_historical: Optional[pandas.core.frame.DataFrame] = None, template: Optional[str] = None, title: Optional[str] = None, xaxis_title: Optional[str] = None, yaxis_title: Optional[str] = None, xaxis: Optional[str] = None, height: Optional[str] = None, width: Optional[str] = None, hovermode: Optional[str] = None) plotly.graph_objs._figure.Figure[source]

Displays line plot of the evolution of the datadrift metrics : AUC of Datadrift classifier and if deployed_model fill, Jensen Shannon divergence of distribution of prediction :param datadrift_historical: DataFrame with date, datadrif classifer auc and jensen shannon prediction divergence if deployed_model fill :type datadrift_historical: pd.DataFrame :param template: Template (background style) for the plot :type template: str, optional :param title: Plot title :type title: str, optional :param xaxis_title: X axis title :type xaxis_title: str, optional :param yaxis_title: y axis title :type yaxis_title: str, optional :param xaxis: X axis options (spike line, margin, range …) :type xaxis: str, optional :param height: Height of the plot :type height: str, optional :param width: Width of the plot :type width: str, optional :param hovermode: Type of labels displaying on mouse hovering :type hovermode: str, optional

Return type

plotly.express.line

generate_modeldrift_data(data_modeldrift: Optional[pandas.core.frame.DataFrame] = None, metric: str = 'performance', reference_columns: list = [], template: Optional[str] = None, title: Optional[str] = None, xaxis_title: Optional[str] = None, yaxis_title: Optional[dict] = None, xaxis: Optional[str] = None, height: Optional[str] = None, width: Optional[str] = None, hovermode: Optional[str] = None) plotly.graph_objs._figure.Figure[source]

Displays line plot of the evolution of the Lift computed for deployed model with several criterias.

Parameters
  • data_modeldrift (pd.DataFrame) – DataFrame containing the aggregated informations to display modeldrift.

  • metric (str) – Column name of the metric computed

  • reference_columns (list) – list of reference columns used to display the metric according to different criteria

  • title (str, optional) – Plot title

  • xaxis_title (str, optional) – X axis title

  • yaxis_title (dict, optional) – y axis title

  • xaxis (str, optional) – X axis options (spike line, margin, range …)

  • height (str, optional) – Height of the plot

  • width (str, optional) – Width of the plot

  • hovermode (str, optional) – Type of labels displaying on mouse hovering

Return type

plotly.express.line

scatter_feature_importance(feature_importance: Optional[pandas.core.frame.DataFrame] = None, datadrift_stat_test: Optional[pandas.core.frame.DataFrame] = None) plotly.graph_objs._figure.Figure[source]

Displays scatter of feature importance between drift model and production one extracted from a datasets created during the compile step.

Parameters
  • feature_importance (pd.DataFrame, optional) – DataFrame containing feature importance for each features from production and drift model.

  • datadrift_stat_test (pd.DataFrame, optional) – DataFrame containing the result of datadrift univariate tests

Return type

plotly.express.scatter