Aug 10, 2024
Import Libraries
numpy
and matplotlib
for calculations and plotting.Generate Toy Dataset
Define Class
MultivariateNormal
.None
.Fit Method
fit(self, x)
method to calculate mu and sigma.numpy
functions to compute covariance matrix and normalize by n-1.Probability Calculation
prob(self, x)
method to predict probabilities:
numpy.einsum
for efficient calculations.Plotting the Distribution