logml.report.plotters.ui_elements

Common UI elements for visualization: charts, tables, etc.

Functions

_get_column_width(dataframe, column)

For a given column returns a width in pixels for that column to display.

_get_column_width_definition(pixels, target)

Wraps a given width definition into a dictionary.

_get_columns_width_definitions(dataframe)

Prepares a list of definitions related to column width for itables.

_get_series_width(data)

Returns the length of the longest value within a given series.

build_averaged_fi_ranking_scatter(...)

Creates a scatter for assessing the result ranking.

make_subplots(total_plots[, plots_per_row, ...])

Creates subplots table to fit total_plots in.

plot_barchart(dataframe, x_column, y_column, ...)

Plots horizontal bar plot using a given dataframe.

plot_grid_plot(df, target, features)

Plots a heatmap comparing categories of a feature with the different categories of a target for a classification problem.

plot_index_table(df[, title, columnwidth, ...])

Plot table with first column emphasized as index.

plot_scatter(dataframe, x_column, y_column)

Plots scatterplot using a given dataframe.

plot_table(dataframe[, title, decimals, ...])

Plots an interactive table for a given dataframe.

to_quantile_df(s, name[, quantiles])

Transform series to displayable quantile data frame.

logml.report.plotters.ui_elements.plot_table(dataframe: pandas.core.frame.DataFrame, title=None, decimals=2, column_defs=None, order: Optional[List[Tuple[int, str]]] = None, **kwargs)

Plots an interactive table for a given dataframe.

Note: this version uses itables.show method. Note that passing default None value is not the same as not passing a value at all. Sometimes passing None completely crashes the table.

Parameters
  • dataframe – data to display

  • title – if provided, rendered as H3 before the table.

  • column_defs – definition of columns, see https://datatables.net/reference/option/columnDefs

  • order – List or (index, direction=’asc|desc’) of columns to sort by. Starts with 0. Note: if index is rendered, it is column 0. If index is hidden, first feature in column 0.

  • kwargs

    Pass parameters to itables.show as kwargs. For full list see https://datatables.net/reference/option/ Useful to know:

    showIndex (specific to itablles) scrollX order

logml.report.plotters.ui_elements.plot_index_table(df: pandas.core.frame.DataFrame, title=None, columnwidth: Optional[List[Union[int, float]]] = None, width=None, height=None, decimals=2, use_columns=False, fill_color='white', line_color='lightgray', line_height=36, font_size=14)

Plot table with first column emphasized as index.

logml.report.plotters.ui_elements.make_subplots(total_plots: int, plots_per_row: int = 3, figsize: Optional[tuple] = None, row_height: int = 5, col_width: int = 5, sharex=False, sharey=False, flatten_axes=True)

Creates subplots table to fit total_plots in.

Returns: tuple (fig, ax)

fig : plt.figure.Figure ax : plt.axes.Axes or array of Axes

logml.report.plotters.ui_elements.to_quantile_df(s: pandas.core.series.Series, name, quantiles=(0.5, 0.75, 0.9, 0.95, 0.99, 1.0)) pandas.core.frame.DataFrame

Transform series to displayable quantile data frame.

logml.report.plotters.ui_elements.build_averaged_fi_ranking_scatter(averaged_ranking: pandas.core.frame.DataFrame)

Creates a scatter for assessing the result ranking.

logml.report.plotters.ui_elements.plot_barchart(dataframe: pandas.core.frame.DataFrame, x_column: str, y_column: str, color_column: str, **kwargs)

Plots horizontal bar plot using a given dataframe.

logml.report.plotters.ui_elements.plot_scatter(dataframe: pandas.core.frame.DataFrame, x_column: str, y_column: str, text_column: Optional[str] = None, **kwargs)

Plots scatterplot using a given dataframe.

logml.report.plotters.ui_elements.plot_grid_plot(df: pandas.core.frame.DataFrame, target: str, features: List[str])

Plots a heatmap comparing categories of a feature with the different categories of a target for a classification problem.