BaseComponentPlot

# Import statement

from hottbox.contrib.visualisation import BaseComponentPlot
class BaseComponentPlot(tensor_rep)[source]

Dashboard for interactive visualisation of the factor vectors

Attributes

available_plots

(dict[str, callable]) Ordered dictionary with all available plot functions for the factor vectors

out

(Output) Widget used as a context manager to display output.

sliders

(list[IntSlider]) List of slider widgets each of which allows to select factor vector to be plotted.

dropdown

(list[Dropdown]) List of dropdown widgets each of which allows to select type of plot for the factor vector selected by the corresponding slider.

dashboard

(VBox) Dashboard with visualisations of the factor vectors and widgets for selection of how and what is going to be displayed.

Methods

extend_available_plots(self, custom_plots[, …])

Add custom plot functions available for representing factor vectors

Constructor of the interactive dashboard

Parameters
tensor_rep{TensorCPD, TensorTKD}

Methods

extend_available_plots(self, custom_plots[, …])

Add custom plot functions available for representing factor vectors

extend_available_plots(self, custom_plots, modes=())[source]

Add custom plot functions available for representing factor vectors

This method can be used either for adding new ways of plotting of the factor vectors or changing ones that have already been defined. Despite of chosen option there are two main steps. First the internal dictionary with plots (self.available_plots) is updated, then dropdown menus.

Parameters
custom_plotsdict[str, callable]

Dictionary with plot functions Keys will be displayed in the dropdown menu. Values will be used as plotting functions for factor vector when the corresponding option from the dropdown menu is selected.

modeslist[int]

List of modes for which keys of custom_plots will be available in the dropdown. If not specified then they will be available for all modes.

Notes

  1. If key from custom_plots is already in self.available_plots.keys(), then the corresponding value will be updated anyway.

  2. When the options of dropdown menu are updated, then index of that dropdown menu is also getting changed. Looks like it is always set to zero which could change the value that is selected in the dropdown menu.

  3. Signature of plotting functions should contain two variables: ax and data

    def my_line_plot(ax, data):
        ax.plot(data, 'r+')