4.2. Compute Mapper Graph of a Point Cloud

The computeMapper module provides functionality to compute the Maper graph of a point cloud.

cereeberus.compute.computemapper.computeMapper(pointcloud, lensfunction, cover, clusteralgorithm, distance_matrix=None)[source]

Computes the mapper graph of an input function.

The point cloud should be given as a list of tuples or as a numpy array. It may be None when a distance_matrix is provided and the lens function is a precomputed list.

The lens function should be given as either a list of numbers with the same length as the number of points; or as a callable function where \(f(point) = \text{value}\) so long as the function can be determined from the coordinate values of the point. When only a distance_matrix is supplied (no pointcloud), the lens function must be a precomputed list.

The cover should be given as a list of intervals. This can be done, for example, using the cereeberus.cover function in this module.

The clustering algorithm should be given as a callable that takes in a point cloud and outputs cluster labels (for example, sklearn.cluster.DBSCAN(min_samples=2, eps=0.3).fit). When a distance_matrix is provided, the callable receives a precomputed square sub-matrix for each cover set, so it should be configured with metric='precomputed' (for example, sklearn.cluster.DBSCAN(metric='precomputed', eps=0.3).fit).

Parameters:
  • pointcloud – a list of tuples or numpy array of coordinates, or None when using a distance matrix without coordinates.

  • lensfunction – a callable f(point) -> value or a precomputed list of values.

  • cover – a list of intervals (see cereeberus.cover).

  • clusteralgorithm'trivial' or a callable clustering algorithm.

  • distance_matrix – optional square numpy array of pairwise distances. When provided, clustering uses this matrix rather than raw coordinates.

Returns:

A MapperGraph object representing the mapper graph of the input data and lens function.

cereeberus.compute.computemapper.cover(min=-1, max=1, numcovers=10, percentoverlap=0.5)[source]

Creates a cover to be used for inputs in the computeMapper function

Parameters:
  • min – the minimum for the range of the covering sets

  • max – the maximum for the range of the covering sets

  • numcovers – number of covers to create

  • percentoverlap – percentage (from 0 to 1) of overlap between covers

Returns:

An array of intervals