Skip to content

Commit 11e5c77

Browse files
committed
BayesianNetworks added
1 parent ba15c0e commit 11e5c77

8 files changed

+1482
-73
lines changed

BayesianNetworks.ipynb

+1,388
Large diffs are not rendered by default.

HiddenMarkovModel.ipynb

+12-6
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
{
1717
"cell_type": "code",
1818
"execution_count": 1,
19-
"metadata": {},
19+
"metadata": {
20+
"collapsed": true
21+
},
2022
"outputs": [],
2123
"source": [
2224
"%matplotlib inline\n",
@@ -338,7 +340,9 @@
338340
{
339341
"cell_type": "code",
340342
"execution_count": 6,
341-
"metadata": {},
343+
"metadata": {
344+
"collapsed": true
345+
},
342346
"outputs": [],
343347
"source": [
344348
"# Forward Pass\n",
@@ -548,12 +552,11 @@
548552
"source": [
549553
"### Smoothing (Forward filtering - Backward smoothing), The Correction Smoother\n",
550554
"\n",
551-
"Suppose we have computed the filtered quantities $p(x_t| y_{1:t})$ via the forward pass. The forward-backward algorithm requires us to store all observations. For batch settings, this is OK however when datapoints are arriving indeed sequentially, this may be not desired. \n",
555+
"Suppose we have computed the filtered quantities $p(x_t| y_{1:t})$ via the forward pass. The forward-backward algorithm requires storing all the observations. In a batch settings, storing the observations and filtering densities may be OK however when observations are arriving indeed sequentially, this may be not desired. \n",
552556
"\n",
553557
"We will derive a recursive algorithm to compute the marginals $p(x_t | y_{1:T})$.\n",
554558
"\n",
555-
"Note that if we calculate instead the so-called __pairwise__ marginal $p(x_t, x_{t+1} | y_{1:T} )$, we can get by simple marginalization\n",
556-
"\n",
559+
"Note that if we calculate instead the so-called __pairwise__ marginal $p(x_t, x_{t+1} | y_{1:T} )$, we can get each marginal simply by: \n",
557560
"\\begin{align}\n",
558561
"p(x_t | y_{1:T}) & = \\sum_{x_{t+1}} p(x_t, x_{t+1} | y_{1:T} ) & \\text{Definition} \n",
559562
"\\end{align}\n",
@@ -718,7 +721,9 @@
718721
{
719722
"cell_type": "code",
720723
"execution_count": 17,
721-
"metadata": {},
724+
"metadata": {
725+
"collapsed": true
726+
},
722727
"outputs": [],
723728
"source": [
724729
"LL = hm.train_EM(y, 100)"
@@ -1252,6 +1257,7 @@
12521257
"cell_type": "code",
12531258
"execution_count": 12,
12541259
"metadata": {
1260+
"collapsed": true,
12551261
"scrolled": true
12561262
},
12571263
"outputs": [],

LSTM.ipynb

+4-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,10 @@
317317
"\n",
318318
"$$\\sinh(x) = \\frac{1}{2}(\\exp(x)-\\exp(-x))$$\n",
319319
"\n",
320-
"$$\\cosh(x) = \\frac{1}{2}(\\exp(x)+\\exp(-x))$$\n"
320+
"$$\\cosh(x) = \\frac{1}{2}(\\exp(x)+\\exp(-x))$$\n",
321+
"\n",
322+
"\n",
323+
"$$\\tanh(x) = \\sigma(2x) - \\sigma(-2x)$$\n"
321324
]
322325
},
323326
{

Logistic Matrix Factorization.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1095,9 +1095,9 @@
10951095
],
10961096
"metadata": {
10971097
"kernelspec": {
1098-
"display_name": "Python [conda root]",
1098+
"display_name": "Python (py36)",
10991099
"language": "python",
1100-
"name": "conda-root-py"
1100+
"name": "py36"
11011101
},
11021102
"language_info": {
11031103
"codemirror_mode": {

LogisticRegression.ipynb

+13-5
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,14 @@
643643
"Exercise: Plot the sigmoid function and its derivative."
644644
]
645645
},
646+
{
647+
"cell_type": "markdown",
648+
"metadata": {},
649+
"source": [
650+
"Exercise: Show that \n",
651+
"$\\tanh(z) = 2\\sigma(2z) - 1$"
652+
]
653+
},
646654
{
647655
"cell_type": "markdown",
648656
"metadata": {},
@@ -1476,21 +1484,21 @@
14761484
],
14771485
"metadata": {
14781486
"kernelspec": {
1479-
"display_name": "Python [conda root]",
1487+
"display_name": "Python (py27)",
14801488
"language": "python",
1481-
"name": "conda-root-py"
1489+
"name": "py27"
14821490
},
14831491
"language_info": {
14841492
"codemirror_mode": {
14851493
"name": "ipython",
1486-
"version": 3
1494+
"version": 2
14871495
},
14881496
"file_extension": ".py",
14891497
"mimetype": "text/x-python",
14901498
"name": "python",
14911499
"nbconvert_exporter": "python",
1492-
"pygments_lexer": "ipython3",
1493-
"version": "3.6.1"
1500+
"pygments_lexer": "ipython2",
1501+
"version": "2.7.13"
14941502
},
14951503
"toc": {
14961504
"nav_menu": {},

ModelingExamples1.ipynb

+58-56
Large diffs are not rendered by default.

SVD.ipynb

+3-1
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,9 @@
643643
{
644644
"cell_type": "code",
645645
"execution_count": 41,
646-
"metadata": {},
646+
"metadata": {
647+
"collapsed": true
648+
},
647649
"outputs": [],
648650
"source": [
649651
"import numpy as np\n",

TextProcessing.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -35910,9 +35910,9 @@
3591035910
],
3591135911
"metadata": {
3591235912
"kernelspec": {
35913-
"display_name": "Python [conda env:py36]",
35913+
"display_name": "Python (py36)",
3591435914
"language": "python",
35915-
"name": "conda-env-py36-py"
35915+
"name": "py36"
3591635916
},
3591735917
"language_info": {
3591835918
"codemirror_mode": {

0 commit comments

Comments
 (0)