View source: R/baskin_robbins.R
| create_1D_mapper_object | R Documentation |
Run Mapper using a one-dimensional filter, a cover of the codomain of intervals, and a clusterer.
create_1D_mapper_object(
data,
dists,
lens,
cover,
clusterer = global_hierarchical_clusterer("single", dists)
)
data |
A data frame. |
dists |
A distance matrix associated to the data frame. Can be a |
lens |
The result of a function applied to the rows of |
cover |
An |
clusterer |
A function which accepts a list of distance matrices as input, and returns the results of clustering done on each distance matrix; that is, it should return a list of named vectors, whose name are the names of data points and whose values are cluster assignments (integers). If this value is omitted, then trivial clustering will be done. |
A list of two data frames, nodes and edges, which contain information about the Mapper graph constructed from the given parameters.
The node data frame consists of:
id: vertex ID
cluster_size: number of data points in cluster
medoid: the name of the medoid of the vertex
mean_dist_to_medoid: mean distance to medoid of cluster
max_dist_to_medoid: max distance to medoid of cluster
cluster_width: maximum pairwise distance within cluster
wcss: sum of squares of distances to cluster medoid
data: names of data points in cluster
patch: level set ID
The edge data frame contains consists of:
source: vertex ID of edge source
target: vertex ID of edge target
weight: Jaccard index of edge; this is the size of the intersection between the vertices divided by the union
overlap_data: names of data points in overlap
overlap_size: number of data points overlap
# Create noisy circle data
data = data.frame(x = sapply(1:1000, function(x) cos(x)) + runif(1000, 0, .25),
y = sapply(1:1000, function(x) sin(x)) + runif(1000, 0, .25))
# Project to horizontal axis as lens
projx = data$x
# Create a one-dimensional cover
num_bins = 5
percent_overlap = 25
cover = create_width_balanced_cover(min(projx), max(projx), num_bins, percent_overlap)
# Build Mapper object
create_1D_mapper_object(data, dist(data), projx, cover)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.