Skip to content

mynameisvinn/PieStats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PieStats

piestats is a bare bones library that samples from a multivariate normal distribution.

usage

from Random import Multivariate_Normal
import matplotlib.pyplot as plt
plt.style.use("ggplot")

cov = np.array([[1, 3], [2, 1]])

x1, x2 = Multivariate_Normal(size=10000, cov=cov)
plt.hist2d(x1, x2, bins=50, cmap='Blues')  # https://jakevdp.github.io/PythonDataScienceHandbook/04.05-histograms-and-binnings.html
cb = plt.colorbar()
cb.set_label('counts in bin')

why do things the easy way when you can do things the hard way?

computers don't know anything about gaussian distributions. they only know uniform distributions, which can be generated from psuedo random numbers. so how do libraries like numpy.random.multivariate_normal emit samples from multivariate distributions?

how dey do dat

first, piestats draws from a uniform distribution. this is a primitive operation that all computers know how to perform. then, it converts these samples into a 1d normal distribution through box muller transformation. finally, it reshapes these normally distribution samples by the specified covariance.

About

implementing statistical stuff from scratch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published