GUI

explore(data=None, embeddings='embedding', targets='target', pred_probs='pred_prob', slices='slices', text=None, text_embeddings='embedding', phrase='output_phrase')[source]

Creates a IPyWidget GUI for exploring discovered slices. The GUI includes two sections: (1) The first section displays data visualizations summarizing the model predictions and accuracy stratified by slice. (2) The second section displays a table (i.e. Meerkat DataPanel) of the data examples most representative of each slice. The DataPanel passed to data should include columns for embeddings, targets, pred_probs and slices. Any additional columns will be included in the visualization in section (2).

Caution

This GUI works best in the original Jupyter Notebook, and may not work properly in a Jupyter Lab or VSCode environment.

Parameters
  • data (mk.DataPanel, optional) – A Meerkat DataPanel with columns for embeddings, targets, and prediction probabilities. The names of the columns can be specified with the embeddings, targets, and pred_probs arguments. Defaults to None.

  • embeddings (Union[str, np.ndarray], optional) – The name of a column in data holding embeddings. If data is None, then an np.ndarray of shape (n_samples, dimension of embedding). Defaults to “embedding”.

  • targets (Union[str, np.ndarray], optional) – The name of a column in data holding class labels. If data is None, then an np.ndarray of shape (n_samples,). Defaults to “target”.

  • pred_probs (Union[str, np.ndarray], optional) – The name of a column in data holding model predictions (can either be “soft” probability scores or “hard” 1-hot encoded predictions). If data is None, then an np.ndarray of shape (n_samples, n_classes) or (n_samples,) in the binary case. Defaults to “pred_probs”.

  • slices (str, optional) – The name of The name of a column in data holding discovered slices. If data is None, then an np.ndarray of shape (num_examples, num_slices). Defaults to “slices”.

  • text (str, optional) – A Meerkat DataPanel with columns for text phrases and their embeddings. The names of the columns can be specified with the text_embeddings and phrase arguments. Defaults to None.

  • text_embeddings (Union[str, np.ndarray], optional) – The name of a colum in text holding embeddings. If text is None, then an np.ndarray of shape (n_phrases, dimension of embedding). Defaults to “embedding”.

  • phrase (Union[str, np.ndarray], optional) – The name of a column in text holding text phrases. If text is None, then an np.ndarray of shape (n_phrases,). Defaults to “output_phrase”.

Return type

None

Examples

from domino import explore, DominoSDM
dp = ...  # prepare the dataset as a Meerkat DataPanel

# split dataset
valid_dp = dp.lz[dp["split"] == "valid"]
test_dp = dp.lz[dp["split"] == "test"]

domino = DominoSDM()
domino.fit(data=valid_dp)
test_dp["slices"] = domino.transform(
    data=test_dp, embeddings="emb", targets="target", pred_probs="probs"
)
explore(data=test_dp)