Skip to content

Instantly share code, notes, and snippets.

@mvaz
Last active November 13, 2015 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mvaz/58803202631a6b7d6335 to your computer and use it in GitHub Desktop.
Save mvaz/58803202631a6b7d6335 to your computer and use it in GitHub Desktop.
Dirichlet processes
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Link: http://www.cs.cmu.edu/~epxing/Class/10701-08s/recitation/dirichlet.pdf"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Binomial Distribution"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Represents the number of successes in a sequence of independent yes / no experiments"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$ P(X = x\\, |\\, n, p) = {n\\choose k}\\, p^k (1-p)^{n-k}$$\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Multinomial Distribution"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Extension of the binomial distribution to k possible outcomes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$P(x_1, \\ldots, x_k\\, |\\, n, p_1, . . . , p_k) \n",
"= \\frac{N!}{\\Pi_{i=1}^{k} p_i^{xi} {x_i!}}$$\n",
"$$\\sum_i x_i = N, x_i \\geq 0$$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Beta Distribution"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- ein\n",
"- zwei\n",
"- drei"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$\\frac{x^{\\alpha-1}(1-x)^{\\beta-1}} { B (\\alpha,\\beta)}\\!$$"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import scipy as sp\n",
"import numpy as np\n",
"import pandas as pd\n",
"from scipy.stats import beta"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.stats.beta.html"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.4.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment