Public Member Functions | |
def | __init__ (self, quantiser, weighting_method="cloud", contrast="gaussian") |
def | fit (self, X, y=None, sample_weight=None) |
def | __call__ (self, measure, sample_weight=None) |
def | transform (self, X, sample_weight=None) |
This class allows to vectorise measures (e.g. point clouds, persistence diagrams, etc) after a quantisation step. ATOL paper: :cite:`royer2019atol` Example -------- >>> from sklearn.cluster import KMeans >>> from gudhi.representations.vector_methods import Atol >>> import numpy as np >>> a = np.array([[1, 2, 4], [1, 4, 0], [1, 0, 4]]) >>> b = np.array([[4, 2, 0], [4, 4, 0], [4, 0, 2]]) >>> c = np.array([[3, 2, -1], [1, 2, -1]]) >>> atol_vectoriser = Atol(quantiser=KMeans(n_clusters=2, random_state=202006)) >>> atol_vectoriser.fit(X=[a, b, c]).centers array([[ 2. , 0.66666667, 3.33333333], [ 2.6 , 2.8 , -0.4 ]]) >>> atol_vectoriser(a) array([1.18168665, 0.42375966]) >>> atol_vectoriser(c) array([0.02062512, 1.25157463]) >>> atol_vectoriser.transform(X=[a, b, c]) array([[1.18168665, 0.42375966], [0.29861028, 1.06330156], [0.02062512, 1.25157463]])
def gudhi.representations.vector_methods.Atol.__init__ | ( | self, | |
quantiser, | |||
weighting_method = "cloud" , |
|||
contrast = "gaussian" |
|||
) |
Constructor for the Atol measure vectorisation class. Parameters: quantiser (Object): Object with `fit` (sklearn API consistent) and `cluster_centers` and `n_clusters` attributes, e.g. sklearn.cluster.KMeans. It will be fitted when the Atol object function `fit` is called. weighting_method (string): constant generic function for weighting the measure points choose from {"cloud", "iidproba"} (default: constant function, i.e. the measure is seen as a point cloud by default). This will have no impact if weights are provided along with measures all the way: `fit` and `transform`. contrast (string): constant function for evaluating proximity of a measure with respect to centers choose from {"gaussian", "laplacian", "indicator"} (default: gaussian contrast function, see page 3 in the ATOL paper).
def gudhi.representations.vector_methods.Atol.__call__ | ( | self, | |
measure, | |||
sample_weight = None |
|||
) |
Apply measure vectorisation on a single measure. Parameters: measure (n x d numpy array): input measure in R^d. Returns: numpy array in R^self.quantiser.n_clusters.
def gudhi.representations.vector_methods.Atol.fit | ( | self, | |
X, | |||
y = None , |
|||
sample_weight = None |
|||
) |
Calibration step: fit centers to the sample measures and derive inertias between centers. Parameters: X (list N x d numpy arrays): input measures in R^d from which to learn center locations and inertias (measures can have different N). y: Ignored, present for API consistency by convention. sample_weight (list of numpy arrays): weights for each measure point in X, optional. If None, the object's weighting_method will be used. Returns: self
def gudhi.representations.vector_methods.Atol.transform | ( | self, | |
X, | |||
sample_weight = None |
|||
) |
Apply measure vectorisation on a list of measures. Parameters: X (list N x d numpy arrays): input measures in R^d from which to learn center locations and inertias (measures can have different N). sample_weight (list of numpy arrays): weights for each measure point in X, optional. If None, the object's weighting_method will be used. Returns: numpy array with shape (number of measures) x (self.quantiser.n_clusters).
GUDHI Version 3.3.0 - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding. - Copyright : MIT | Generated on Tue Aug 11 2020 11:58:59 for GUDHI by Doxygen 1.8.18 |