gudhi.representations.vector_methods.PersistenceImage Class Reference

Finite Vectorization methods ##############. More...

Public Member Functions

def __init__ (self, bandwidth=1., weight=lambda x:1, resolution=[20, 20], im_range=[np.nan, np.nan, np.nan, np.nan])
 
def fit (self, X, y=None)
 
def transform (self, X)
 
def __call__ (self, diag)
 

Detailed Description

Finite Vectorization methods ##############.

This is a class for computing persistence images from a list of persistence diagrams. A persistence image is a 2D function computed from a persistence diagram by convolving the diagram points with a weighted Gaussian kernel. The plane is then discretized into an image with pixels, which is flattened and returned as a vector. See http://jmlr.org/papers/v18/16-337.html for more details.

Constructor & Destructor Documentation

◆ __init__()

def gudhi.representations.vector_methods.PersistenceImage.__init__ (   self,
  bandwidth = 1.,
  weight = lambda x: 1,
  resolution = [20,20],
  im_range = [np.nan, np.nan, np.nan, np.nan] 
)
Constructor for the PersistenceImage class.

Parameters:
    bandwidth (double): bandwidth of the Gaussian kernel (default 1.).
    weight (function): weight function for the persistence diagram points (default constant function, ie lambda x: 1). This function must be defined on 2D points, ie lists or numpy arrays of the form [p_x,p_y].
    resolution ([int,int]): size (in pixels) of the persistence image (default [20,20]).
    im_range ([double,double,double,double]): minimum and maximum of each axis of the persistence image, of the form [x_min, x_max, y_min, y_max] (default [numpy.nan, numpy.nan, numpy.nan, numpyp.nan]). If one of the values is numpy.nan, it can be computed from the persistence diagrams with the fit() method.

Member Function Documentation

◆ __call__()

def gudhi.representations.vector_methods.PersistenceImage.__call__ (   self,
  diag 
)
Apply PersistenceImage on a single persistence diagram and outputs the result.

Parameters:
    diag (n x 2 numpy array): input persistence diagram.

Returns:
    numpy array with shape (number of pixels = **resolution[0]** x **resolution[1]**):: output persistence image.

◆ fit()

def gudhi.representations.vector_methods.PersistenceImage.fit (   self,
  X,
  y = None 
)
Fit the PersistenceImage class on a list of persistence diagrams: if any of the values in **im_range** is numpy.nan, replace it with the corresponding value computed on the given list of persistence diagrams.

Parameters:
    X (list of n x 2 numpy arrays): input persistence diagrams.
    y (n x 1 array): persistence diagram labels (unused).

◆ transform()

def gudhi.representations.vector_methods.PersistenceImage.transform (   self,
  X 
)
Compute the persistence image for each persistence diagram individually and store the results in a single numpy array.

Parameters:
    X (list of n x 2 numpy arrays): input persistence diagrams.
    
Returns:
    numpy array with shape (number of diagrams) x (number of pixels = **resolution[0]** x **resolution[1]**): output persistence images.

The documentation for this class was generated from the following file:
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