Coverage for src/serums/enums.py: 88%
32 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-11 16:43 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-11 16:43 +0000
1"""Enumerations used by SERUMS."""
2import enum
5@enum.unique
6class GSMTypes(enum.Enum):
7 """Gaussian Scale Mixture Types."""
9 STUDENTS_T = enum.auto()
10 """Student's t-distribution."""
12 CAUCHY = enum.auto()
13 """Cauchy distribution."""
15 SYMMETRIC_A_STABLE = enum.auto()
16 r"""Symmetric :math:`\alpha`-stable distribution."""
18 def __str__(self):
19 """Return the enum name for strings."""
20 return self.name
23@enum.unique
24class SingleObjectDistance(enum.Enum):
25 """Enumeration for distance methods."""
27 MANHATTAN = enum.auto()
28 r"""The Manhattan/taxicab/:math:`L_1` distance.
30 Notes
31 -----
32 Uses the form
34 .. math::
35 d(x, y) = \Sigma_i \vert x_i - y_i \vert
36 """
38 EUCLIDEAN = enum.auto()
39 r"""The euclidean distance between two points.
41 Notes
42 -----
43 Uses the form :math:`d(x, y) = \sqrt{(x-y)^T(x-y)}`.
44 """
46 HELLINGER = enum.auto()
47 r"""The hellinger distance between two probability distributions.
49 Notes
50 -----
51 It is at most 1, and for Gaussian distributions it takes the form
53 .. math::
54 d_H(f,g) &= 1 - \sqrt{\frac{\sqrt{\det{\left[\Sigma_x \Sigma_y\right]}}}
55 {\det{\left[0.5\Sigma\right]}}} \exp{\epsilon} \\
56 \epsilon &= \frac{1}{4}(x - y)^T\Sigma^{-1}(x - y) \\
57 \Sigma &= \Sigma_x + \Sigma_y
58 """
60 MAHALANOBIS = enum.auto()
61 r"""The Mahalanobis distance between a point and a distribution.
63 Notes
64 -----
65 Uses the form :math:`d(x, y) = \sqrt{(x-y)^T\Sigma_y^{-1}(x-y)}`.
66 """
68 def __str__(self):
69 """Return the enum name for strings."""
70 return self.name
73@enum.unique
74class MultiObjectDistance(enum.Enum):
75 """Enumeration of multi-object distance types."""
77 OSPA = enum.auto()
78 """The Optimal Sub-Pattern Assignment distance between two point processes."""
80 OSPA2 = enum.auto()
81 """The Optimal Sub-Pattern Assignment(2)` distance."""
83 def __str__(self):
84 """Return the enum name for strings."""
85 return self.name
88# @enum.unique
89# class GoodnessOfFitTest(enum.Enum):
90# """Enumeration of Goodness of Fit Tests for distribution parameter estimation."""
92# CRAMER_VON_MISES = enum.auto()
93# """Cramer von Mises criterion for goodness of fit of a distribution to a set of samples."""
95# KOLMOGOROV_SMIRNOV = enum.auto()
96# """Kolmogorov Smirnov test for goodness of fit of a distribution to a set of samples."""
98# ANDERSON_DARLING = enum.auto()
99# """Anderson-Darling test for goodness of fit of two sets of samples.
100# This test puts higher emphasis on the tails of the distribution."""
102# def __str__(self):
103# """Return the enum name for strings."""
104# return self.name
107@enum.unique
108class DistEstimatorMethod(enum.Enum):
109 """Enumeration of distribution estimator methods."""
111 CRAMER_VON_MISES = enum.auto()
112 """Cramer von Mises criterion for goodness of fit of a distribution to a set of samples."""
114 KOLMOGOROV_SMIRNOV = enum.auto()
115 """Kolmogorov Smirnov test for goodness of fit of a distribution to a set of samples."""
117 ANDERSON_DARLING = enum.auto()
118 """Anderson-Darling test for goodness of fit of two sets of samples. This test puts higher emphasis on the tails of the distribution."""
120 GRIMSHAW_MLE = enum.auto()
121 """Grimshaw's MLE method for GPD parameter estimation."""
123 METHOD_OF_MOMENTS = enum.auto()
124 """Estimate distribution parameters using the Method of Moments."""
126 PROBABILITY_WEIGHTED_MOMENTS = enum.auto()
127 """Estimate distribution parameters using the method of Probability-Weighted Moments."""
129 def __str__(self):
130 """Return the enum name for strings."""
131 return self.name