Diffusion maps
Diffusion maps leverages the relationship between heat diffusion and a random walk; an analogy is drawn between the diffusion operator on a manifold and a Markov transition matrix operating on functions defined on the graph whose nodes were sampled from the manifold [1].
This package defines a DiffMap
type to represent a diffusion map results, and provides a set of methods to access its properties.
ManifoldLearning.DiffMap
— TypeDiffMap{T <: Real} <: AbstractDimensionalityReduction
The DiffMap
type represents diffusion maps model constructed for T
type data.
StatsAPI.fit
— Methodfit(DiffMap, data; maxoutdim=2, t=1, α=0.0, ɛ=1.0)
Fit a isometric mapping model to data
.
Arguments
data::Matrix
: a $d \times n$matrix of observations. Each column ofdata
is
an observation, d
is a number of features, n
is a number of observations.
Keyword arguments
kernel::Union{Nothing, Function}
: the kernel function.
It maps two input vectors (observations) to a scalar (a metric of their similarity). by default, a Gaussian kernel. If kernel
set to nothing
, we assume data
is instead the $n \times n$ precomputed Gram matrix.
ɛ::Real=1.0
: the Gaussian kernel variance (the scale parameter). It's ignored if the customkernel
is passed.maxoutdim::Int=2
: the dimension of the reduced space.t::Int=1
: the number of transitionsα::Real=0.0
: a normalization parameter
Examples
X = rand(3, 100) # toy data matrix, 100 observations
# default kernel
M = fit(DiffMap, X) # construct diffusion map model
R = transform(M) # perform dimensionality reduction
# custom kernel
kernel = (x, y) -> x' * y # linear kernel
M = fit(DiffMap, X, kernel=kernel)
# precomputed Gram matrix
kernel = (x, y) -> x' * y # linear kernel
K = ManifoldLearning.pairwise(kernel, eachcol(X), symmetric=true)
M = fit(DiffMap, K, kernel=nothing)
StatsAPI.predict
— Methodpredict(R::DiffMap)
Transforms the data fitted to the diffusion map model R
into a reduced space representation.
ManifoldLearning.kernel
— MethodReturns the kernel matrix of the diffusion maps model R
References
- 1Coifman, R. & Lafon, S. "Diffusion maps". Applied and Computational Harmonic Analysis, Elsevier, 2006, 21, 5-30. DOI:10.1073/pnas.0500334102