VisualAppBase

class rectools.visuals.visual_app.VisualAppBase(data_storage: AppDataStorage, auto_display: bool = True, formatters: Optional[Dict[str, Callable]] = None, rows_limit: int = 20, min_width: int = 50)[source]

Bases: object

Jupyter widgets app for recommendations visualization and models comparison. Warning! This is a base class. Do not create instances of this class directly. Use derived classes construct methods instead.

Inherited-members

Parameters
  • data_storage (AppDataStorage) –

  • auto_display (bool) –

  • formatters (Optional[Dict[str, Callable]]) –

  • rows_limit (int) –

  • min_width (int) –

Methods

display()

Display full VisualApp widget

load(folder_name[, auto_display, ...])

Create widgets from data that was processed and saved earlier.

save(folder_name[, overwrite])

Save stored data to re-create widgets when necessary.

display() None[source]

Display full VisualApp widget

Return type

None

classmethod load(folder_name: str, auto_display: bool = True, formatters: Optional[Dict[str, Callable]] = None, rows_limit: int = 20, min_width: int = 100) VisualAppT[source]

Create widgets from data that was processed and saved earlier.

Parameters
  • folder_name (str) – Destination folder for data.

  • auto_display (bool, optional, default True) – Display widgets right after initialization.

  • formatters (tp.Optional[tp.Dict[str, tp.Callable]], optional, default None) – Formatter functions to apply to columns elements in the sections of interactions and recommendations. Keys of the dict must be columns names (item_data, interactions and recommendations columns can be specified here). Values bust be functions that will be applied to corresponding columns elements. The result of each function must be a unicode string that represents html code. Formatters can be used to format text, create links and display images with html.

  • rows_limit (int, optional, default 20) – Maximum number of rows to display in the sections of interactions and recommendations.

  • min_width (int, optional, default 100) – Minimum column width in pixels for dataframe columns in widgets output. Must be greater then 10.

Returns

Jupyter widgets for recommendations visualization.

Return type

VisualAppBase

save(folder_name: str, overwrite: bool = False) None[source]

Save stored data to re-create widgets when necessary. Use VisualAppBase.load class method for re-creation or any other child classes (VisualApp, ItemToItemVisualApp).

Parameters
  • folder_name (str) – Destination folder for data.

  • overwrite (bool, default False) – Allow to overwrite in the folder files if they already exist.

Return type

None