aboutsummaryrefslogtreecommitdiff
path: root/code/sunlab/common/distribution/gaussian_distribution.py
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2024-11-11 12:29:32 -0800
committerChristian C <cc@localhost>2024-11-11 12:29:32 -0800
commitb85ee9d64a536937912544c7bbd5b98b635b7e8d (patch)
treecef7bc17d7b29f40fc6b1867d0ce0a742d5583d0 /code/sunlab/common/distribution/gaussian_distribution.py
Initial commit
Diffstat (limited to 'code/sunlab/common/distribution/gaussian_distribution.py')
-rw-r--r--code/sunlab/common/distribution/gaussian_distribution.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/code/sunlab/common/distribution/gaussian_distribution.py b/code/sunlab/common/distribution/gaussian_distribution.py
new file mode 100644
index 0000000..e478ab6
--- /dev/null
+++ b/code/sunlab/common/distribution/gaussian_distribution.py
@@ -0,0 +1,23 @@
+from .adversarial_distribution import *
+
+
+class GaussianDistribution(AdversarialDistribution):
+ """# Gaussian Distribution"""
+
+ def __init__(self, N):
+ """# Gaussian Distribution Initialization
+
+ Initializes the name and dimensions"""
+ super().__init__(N)
+ self.full_name = f"{N}-Dimensional Gaussian Distribution"
+ self.name = "G"
+
+ def __call__(self, *args):
+ """# Magic method when calling the distribution
+
+ This method is going to be called when you use gauss(N1,...,Nm)"""
+ import numpy as np
+
+ return np.random.multivariate_normal(
+ mean=np.zeros(self.dims), cov=np.eye(self.dims), size=[*args]
+ )