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,
filtered_data,
cover,
clusterer = global_hierarchical_clusterer("single", dists)
)
data |
A data frame. |
dists |
A distance matrix associated to the data frame. Can be a |
filtered_data |
The result of a function applied to the data frame; there should be one filter value per observation in the original data frame. These values need to be named, and the names of these values must match the names of the original data set. |
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 vertex
mean_dist_to_medoid
: mean distance to medoid of vertex
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:100, function(x) cos(x)), y = sapply(1:100, function(x) sin(x)))
# Project to horizontal axis as lens
projx = data$x
names(projx) = row.names(data)
# Create a one-dimensional cover
num_bins = 10
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.