cknn package¶
Submodules¶
cknn.cknn module¶
-
class
cknn.cknn.
CkNearestNeighbors
(n_neighbors=5, delta=1.0, metric='euclidean', t='inf', include_self=False, is_sparse=True)¶ Bases:
object
This object provides the all logic of CkNN.
- Parameters
n_neighbors – int, optional, default=5 Number of neighbors to estimate the density around the point. It appeared as a parameter k in the paper.
delta – float, optional, default=1.0 A parameter to decide the radius for each points. The combination radius increases in proportion to this parameter.
metric – str, optional, default=’euclidean’ The metric of each points. This parameter depends on the parameter metric of scipy.spatial.distance.pdist.
t –
‘inf’ or float or int, optional, default=’inf’ The decay parameter of heat kernel. The weights are calculated as follow:
W_{ij} = exp(-(||x_{i}-x_{j}||^2)/t)
For more infomation, read the paper ‘Laplacian Eigenmaps for Dimensionality Reduction and Data Representation’, Belkin, et. al.
include_self – bool, optional, default=True All diagonal elements are 1.0 if this parameter is True.
is_sparse – bool, optional, default=True The method cknneighbors_graph returns csr_matrix object if this parameter is True else returns ndarray object.
-
cknneighbors_graph
(X)¶ A method to calculate the CkNN graph
- Parameters
X – ndarray The data matrix.
- return: csr_matrix (if self.is_sparse is True)
or ndarray(if self.is_sparse is False)
-
cknn.cknn.
cknneighbors_graph
(X, n_neighbors, delta=1.0, metric='euclidean', t='inf', include_self=False, is_sparse=True, return_instance=False)¶
Module contents¶
The cknn
module implements the Continuous k-Nearest Neighbors[1].
Reference¶
- 1
T. Berry and T. Sauer, “Consistent man-ifold representation for topological dataanalysis,” 2016.
-
cknn.
cknneighbors_graph
(X, n_neighbors, delta=1.0, metric='euclidean', t='inf', include_self=False, is_sparse=True, return_instance=False)¶
-
class
cknn.
CkNearestNeighbors
(n_neighbors=5, delta=1.0, metric='euclidean', t='inf', include_self=False, is_sparse=True)¶ Bases:
object
This object provides the all logic of CkNN.
- Parameters
n_neighbors – int, optional, default=5 Number of neighbors to estimate the density around the point. It appeared as a parameter k in the paper.
delta – float, optional, default=1.0 A parameter to decide the radius for each points. The combination radius increases in proportion to this parameter.
metric – str, optional, default=’euclidean’ The metric of each points. This parameter depends on the parameter metric of scipy.spatial.distance.pdist.
t –
‘inf’ or float or int, optional, default=’inf’ The decay parameter of heat kernel. The weights are calculated as follow:
W_{ij} = exp(-(||x_{i}-x_{j}||^2)/t)
For more infomation, read the paper ‘Laplacian Eigenmaps for Dimensionality Reduction and Data Representation’, Belkin, et. al.
include_self – bool, optional, default=True All diagonal elements are 1.0 if this parameter is True.
is_sparse – bool, optional, default=True The method cknneighbors_graph returns csr_matrix object if this parameter is True else returns ndarray object.
-
cknneighbors_graph
(X)¶ A method to calculate the CkNN graph
- Parameters
X – ndarray The data matrix.
- return: csr_matrix (if self.is_sparse is True)
or ndarray(if self.is_sparse is False)