cascade.meta#
- class cascade.meta.DiffViewer(path: str)[source]#
The dash-based server to view meta-data and compare different snapshots using deep diff.
It can work with Repos or Workspaces
- class cascade.meta.HistoryViewer(container: Workspace | Repo | ModelLine, last_lines: int | None = None, last_models: int | None = None, update_period_sec: int = 3)[source]#
The tool which allows user to visualize training history of model versions. Uses shows how metrics of models changed over time and how models with different hyperparameters depend on each other.
- __init__(container: Workspace | Repo | ModelLine, last_lines: int | None = None, last_models: int | None = None, update_period_sec: int = 3) None [source]#
- Parameters:
container (Union[Workspace, Repo, ModelLine]) – Container of models to be viewed
last_lines (int, optional) – Constraints the number of lines back from the last one to view
last_models (int, optional) – For each line constraints the number of models back from the last one to view
update_period_sec (int, default is 3) – Update period in seconds
- plot(metric: str, show: bool = False) Any [source]#
Plots training history of model versions using plotly.
- Parameters:
metric (str) – Metric should be present in meta of at least one model in repo
show (bool, optional) – Whether to return and show or just return figure
- serve(metric: str | None = None, **kwargs: Any) None [source]#
Runs dash-based server with HistoryViewer, updating plots in real-time.
- Parameters:
metric – One of the metrics in the repo. May be left None and chosen later in the interface
optional – One of the metrics in the repo. May be left None and chosen later in the interface
**kwargs – Arguments for app.run_server() for example port or host
Note
This feature needs
dash
to be installed.
- class cascade.meta.MetaViewer(root: str, filt: Dict[Any, Any] | None = None)[source]#
The class to view all metadata in folders and subfolders.
- __getitem__(index: int) List[Dict[Any, Any]] [source]#
- Returns:
meta – Meta object that was read from file
- Return type:
Meta
- __init__(root: str, filt: Dict[Any, Any] | None = None) None [source]#
- Parameters:
root (str) – path to the folder containing metadata files
filt (Dict, optional) – dictionary that specifies which values that should be present in meta for example to find all models use
filt={'type': 'model'}
See also
cascade.meta.MetaHandler
- class cascade.meta.MetricViewer(repo: Repo | ModelLine, scope: int | str | slice | None = None)[source]#
Interface for viewing metrics in model meta files uses Repo to extract metrics of all models if any. As metrics it uses data from
metrics
field in models’ meta and as parameters it usesparams
field.- __getitem__(key: int | str | slice)[source]#
Sets the scope of the viewer after creation. Basically creates new viewer with another scope.
- __init__(repo: Repo | ModelLine, scope: int | str | slice | None = None) None [source]#
- Parameters:
repo (Repo) – Repo object to extract metrics from
scope (Union[int, str, slice]) – Index or a name of line to view. Can be set using
__getitem__
- get_best_by(metric: str, maximize: bool = True) Model [source]#
Loads the best model by the given metric
- Parameters:
metric (str) – Name of the metric
maximize (bool) – The direction of choosing the best model:
True
if greater is better andFalse
if less is better
- Raises:
TypeError if metric objects cannot be sorted. If only one model in repo, then –
returns it without error since no sorting involved. –
- plot_table(show: bool = False)[source]#
Uses plotly to graphically show table with metrics and parameters.
- serve(page_size: int = 50, include: List[str] | None = None, exclude: List[str] | None = None, **kwargs: Any) None [source]#
Runs dash-based server with interactive table of metrics and parameters
- Parameters:
page_size (int, optional) – Size of the table in rows on one page
include (List[str], optional:) – List of parameters or metrics to be added. Only they will be present along with some default
exclude (List[str], optional:) – List of parameters or metrics to be excluded from table
**kwargs – Arguments of dash app. Can be ip or port for example