# kmapper.KeplerMapper¶

class kmapper.KeplerMapper(verbose=0)[source]

With this class you can build topological networks from (high-dimensional) data.

1. Fit a projection/lens/function to a dataset and transform it. For instance “mean_of_row(x) for x in X”

2. Map this projection with overlapping intervals/hypercubes. Cluster the points inside the interval (Note: we cluster on the inverse image/original data to lessen projection loss). If two clusters/nodes have the same members (due to the overlap), then: connect these with an edge.

3. Visualize the network using HTML and D3.js.

KM has a number of nice features, some which get forgotten.
• project: Some projections it makes sense to use a distance matrix, such as knn_distance_#. Using distance_matrix = <metric> for a custom metric.

• fit_transform: Applies a sequence of projections. Currently, this API is a little confusing and might be changed in the future.

__init__(verbose=0)[source]

Constructor for KeplerMapper class.

Parameters

verbose (int, default is 0) – Logging level. Currently 3 levels (0,1,2) are supported. For no logging, set verbose=0. For some logging, set verbose=1. For complete logging, set verbose=2.

Methods

 __init__([verbose]) Constructor for KeplerMapper class. data_from_cluster_id(cluster_id, graph, data) Returns the original data of each cluster member for a given cluster ID fit_transform(X[, projection, scaler, …]) Same as .project() but accepts lists for arguments so you can chain. map(lens[, X, clusterer, cover, nerve, …]) Apply Mapper algorithm on this projection and build a simplicial complex. project(X[, projection, scaler, distance_matrix]) Creates the projection/lens from a dataset. visualize(graph[, color_values, colorscale, …]) Generate a visualization of the simplicial complex mapper output.