Coder Social home page Coder Social logo

piestats's Introduction

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.

piestats's People

Contributors

mynameisvinn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.