You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Modified PersistenceImager().__repr__ to create a valid constructor.
- Removed PersistenceImager().dict_print and replaced with prettyprint.
- Changed default kernel function name from bvncdf to gaussian to make more understandable.
- Added a new test to ensure guassian parameter sigma can be either a numpy array or a list of lists.
- Renamed some kernel functions by removing leading underscore to ensure proper loading.
- Updated block comments in PersistenceImager() to reflect updated __repr__ method.
Kernel functions for PersistenceImager() transformer:
3
+
4
+
A valid kernel is a Python function of the form
5
+
6
+
kernel(x, y, mu=(birth, persistence), **kwargs)
7
+
8
+
defining a cumulative distribution function(CDF) such that kernel(x, y) = P(X <= x, Y <=y), where x and y are numpy arrays of equal length.
9
+
10
+
The required parameter mu defines the dependance of the kernel on the location of a persistence pair and is usually taken to be the mean of the probability distribution function associated to kernel CDF.
11
+
"""
12
+
importnumpyasnp
13
+
fromscipy.specialimporterfc
14
+
15
+
defuniform(x, y, mu=None, width=1, height=1):
16
+
w1=np.maximum(x- (mu[0] -width/2), 0)
17
+
h1=np.maximum(y- (mu[1] -height/2), 0)
18
+
19
+
w=np.minimum(w1, width)
20
+
h=np.minimum(h1, height)
21
+
22
+
returnw*h/ (width*height)
23
+
24
+
25
+
defgaussian(birth, pers, mu=None, sigma=None):
26
+
"""
27
+
Optimized bivariate normal cumulative distribution function for computing persistence images using a Gaussian kernel
28
+
:param birth: birth-coordinate(s) of pixel corners
29
+
:param pers: persistence-coordinate(s) of pixel corners
30
+
:param mu: (2,)-numpy array specifying x and y coordinates of distribution means (birth-persistence pairs)
31
+
:param sigma: (2,2)-numpy array specifying distribution covariance matrix or numeric if distribution is isotropic
Weight Functions for PersistenceImager() transformer:
3
+
4
+
A valid weight function is a Python function of the form
5
+
6
+
weight(birth, persistence, **kwargs)
7
+
8
+
defining a scalar-valued function over the birth-persistence plane, where birth and persistence are assumed to be numpy arrays of equal length. To ensure stability, functions should vanish continuously at the line persistence = 0.
0 commit comments