ograph.applications package

Submodules

ograph.applications.swarm module

ograph.applications.swarm.plot_positions(data: ndarray[tuple[Any, Any], dtype[float64]] | Sequence[Sequence[float]] | ndarray[tuple[Any, Any, Any], dtype[float64]] | Sequence[Sequence[Sequence[float]]], objective: Callable[[float, float], float] | None = None, *, override_region: ndarray[tuple[Any, Any], dtype[float64]] | Sequence[Sequence[float]] | None = None, override_margin: float | None = None)[source]

Plot a sequence of collections of points as they change over time.

Parameters:
  • data

    Either a 2-D tensor or a 3-D tensor. * If data is 2-D: data[t] is a single point. Plot

    its change over time.

    • If data is 3-D: data[t] is a collection oof

      points. Plot the change of these points over time.

  • objective – An objective function to be plotted as background.

  • override_region – Only plot points that fall in this region.

  • override_margin – A small margin to add to override_region. Might make the plot prettier.

ograph.applications.swarm.plot_bests(data: ~numpy.ndarray[tuple[~typing.Any, ~typing.Any], ~numpy.dtype[~numpy.float64]] | ~typing.Sequence[~typing.Sequence[float]], best_selector: ~typing.Callable[[~numpy.ndarray[tuple[~typing.Any, ~typing.Any], ~numpy.dtype[~numpy.float64]] | ~typing.Sequence[~typing.Sequence[float]]], ~numpy.float64] = <function max>, best_label: str = 'Best value', all_label: str = 'All values') None[source]

Plot a sequence of numbers against the best one. The “best value” is plotted as a horizontal line.

Parameters:
  • data – A sequence of points to be plotted. Each data[i] should be a 2-D point.

  • best_selector – A Callable that returns the best value in data. To plot a pre-determined, constant best value, let best_selector always return that value.

  • best_label – Label for the best value.

  • all_label – Label for other values.

Module contents

Utilities for plotting clusters of points. Initially designed to visualise swarm-based algorithms.