gmm
This submodule provides implementations of Gaussian Mixture Models (GMMs) with identical covariance across components, including a periodic extension to handle data on a bounded interval via component replication.
Classes:
-
GMM–Defines a mixture of N Gaussians with shared scalar standard deviation. Offers methods to compute the probability density function (PDF) and its natural logarithm over input samples.
-
PeriodicGMM–Inherits from GMM and adds support for periodic domains [0, bound]. It replicates mixture components across multiple copies of the domain to evaluate densities that respect periodic boundary conditions.
GMM(means, std)
dataclass
¶
Gaussian Mixture Model of N Gaussians with identical covariance.
Parameters:
-
means(ndarray) –The means of the Gaussians.
-
std(float) –A scalar representing the standard deviation of the Gaussians.
pdf(X)
¶
Calculate the probability density function (PDF) of the Gaussian Mixture Model.
Parameters:
-
X(ndarray) –The input data.
Returns:
-
float–The PDF value.
Source code in src/fpsl/utils/gmm.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
ln_pdf(X)
¶
Calculate the natural logarithm of the probability density function (PDF) of the Gaussian Mixture Model.
Parameters:
-
X(ndarray) –The input data.
Returns:
-
ndarray–The natural logarithm of the PDF value.
Source code in src/fpsl/utils/gmm.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
PeriodicGMM(means, std, bound=1.0, copies=5)
dataclass
¶
Bases: GMM, DefaultDataClass
Gaussian Mixture Model of N Gaussians with identical covariance.
Parameters:
-
means(ndarray) –The means of the Gaussians.
-
std(Union[ndarray, int]) –A scalar representing the standard deviation of the Gaussians.
-
bound(float, default:1.0) –The data is periodic on [0, bound].
-
copies(int, default:5) –Number of copies in each direction.
pdf(X)
¶
Calculate the probability density function (PDF) of the Gaussian Mixture Model.
Parameters:
-
X(ndarray) –The input data.
Returns:
-
ndarray–The PDF values.
Source code in src/fpsl/utils/gmm.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |