geowatch.mlops.aggregate_plots module

Plotting logic for Aggregator. These plots illustrate the relationshp between parameters and metrics from various vantage points.

Used by ./aggregate.py

geowatch.mlops.aggregate_plots.build_plotter(agg, rois, plot_config)[source]

Used by Aggregator, which will generally immediately call ParamPlotter.plot_requested().

Returns:

ParamPlotter

geowatch.mlops.aggregate_plots.build_all_param_plots(agg, rois, plot_config)[source]

Main entry point for plotting results from an Aggregator.

geowatch.mlops.aggregate_plots.build_special_columns(agg)[source]
geowatch.mlops.aggregate_plots.preprocess_table_for_seaborn(agg, table)[source]
class geowatch.mlops.aggregate_plots.ParamPlotter(agg, vantage_points=None)[source]

Bases: object

Builds the scatter and box-and-whisker plots over different params. Working on cleaning this up

plot_requested()[source]

Simplified entry point

plot_resources()[source]

Draw tables that summarize the resource usage of the experiments.

plot_overviews()[source]

Draw the overview for each vantage point. Draw tables that summarize the resource usage of the experiments.

plot_params()[source]
plot_vantage_per_region_overview(vantage)[source]

Draw scatter plots and box plots that that distinguish each region with respect to a vantage point.

Parameters:

vantage (Dict) – The primary and secondary metric to look at results with. This must have keys: metric1, metric2 and can optionally contain keys: scale1, scale2, objective1, and objective2.

plot_vantage_macro_overview(vantage)[source]

Draw a scatter plot that gives an overview of the requested macro table wrt to a metric vantage point.

Parameters:

vantage (Dict) – The primary and secondary metric to look at results with. This must have keys: metric1, metric2 and can optionally contain keys: scale1, scale2, objective1, and objective2.

plot_vantage_params(vantage, pman=None, params_of_interest=None)[source]

The main parameter inspection plots.

A vantage point specifies the metrics to visualize and analyze. Makes scatter plot, box plots, and attempts to draw legends useful for communicating results.

The main per-paramter logic is in _plot_single_vantage_param().

Writes two folders in the “macro-plots-*” folder: params, and vantage. Both folders contain the same data, but it is laid out differently.

  1. The params folder contains a sub-folder for each parameter, and that folder contains plots for all vantage points.

  2. The “vantage” folder contains a sub-folder for each vantage point and all parameters plotted with that vantage point are plotted here. This folder will typically be symlinks into the above “params” folder.

Parameters:
  • vantage (Dict) – The primary and secondary metric to look at results with. This must have keys: metric1, metric2 and can optionally contain keys: scale1, scale2, objective1, and objective2.

  • pman (ProgressManager | None) – a progress manager used to indicate sub-progress of plotting

geowatch.mlops.aggregate_plots.edit_distance(string1, string2)[source]

Edit distance algorithm. String1 and string2 can be either strings or lists of strings

Parameters:
  • string1 (str | List[str])

  • string2 (str | List[str])

Requirements:

pip install python-Levenshtein

Returns:

float | List[float] | List[List[float]]

Example

>>> # xdoctest: +REQUIRES(module:Levenshtein)
>>> string1 = 'hello world'
>>> string2 = ['goodbye world', 'rofl', 'hello', 'world', 'lowo']
>>> edit_distance(['hello', 'one'], ['goodbye', 'two'])
>>> edit_distance('hello', ['goodbye', 'two'])
>>> edit_distance(['hello', 'one'], 'goodbye')
>>> edit_distance('hello', 'goodbye')
>>> distmat = edit_distance(string1, string2)
>>> result = ('distmat = %s' % (ub.repr2(distmat),))
>>> print(result)
>>> [7, 9, 6, 6, 7]
geowatch.mlops.aggregate_plots.suggest_did_you_mean(invalid_options, valid_choices)[source]
Parameters:
  • missing (List[str]) – the invalid options the user chose

  • valid_choices (List[str]) – the valid available options

Example

>>> from geowatch.mlops.aggregate_plots import *  # NOQA
>>> invalid_options = ['fuber', 'yam', 'spam']
>>> valid_choices = ['spam', 'ham', 'foobar']
>>> suggest_did_you_mean(invalid_options, valid_choices)
geowatch.mlops.aggregate_plots.shrink_param_names(param_name, param_values, text_len_thresh=20)[source]
exception geowatch.mlops.aggregate_plots.SkipPlot[source]

Bases: Exception

class geowatch.mlops.aggregate_plots.Vantage2[source]

Bases: dict

The primary and secondary metric to look at results with. This must have keys: metric1, metric2 and can optionally contain keys: scale1, scale2, objective1, and objective2.

property name
property metric1
property metric2
property scale1
property scale2
class geowatch.mlops.aggregate_plots.Vantage(metric1: str, metric2: str, scale1: str = 'linear', scale2: str = 'linear', objective1: str = 'maximize', objective2: str = 'maximize', name: str = None)[source]

Bases: object

The primary and secondary metric to look at results with. This must have keys: metric1, metric2 and can optionally contain keys: scale1, scale2, objective1, and objective2.

Example

>>> from geowatch.mlops.aggregate_plots import *  # NOQA
>>> Vantage('metrics.ppv', 'metrics.tpr')
metric1: str
metric2: str
scale1: str = 'linear'
scale2: str = 'linear'
objective1: str = 'maximize'
objective2: str = 'maximize'
name: str = None