Skip to content

Commit 20c1cb1

Browse files
committed
2019 update of the NBC and GP classes
1 parent 751887f commit 20c1cb1

File tree

2 files changed

+375
-58
lines changed

2 files changed

+375
-58
lines changed

4 - Naive Bayes Classification/Naive Bayes Classification.ipynb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@
186186
"Let's generalize.\n",
187187
"\n",
188188
"<div class=\"alert alert-success\">\n",
189+
" \n",
190+
" \n",
189191
"Given $n$ features $X_i$ and classes $Y$, **naive Bayes classifiers** estimate (from data) the distributions $\\mathbb{P}(Y)$ and $\\mathbb{P}(X_i|Y)$. Then, using Bayes rule and the naive Bayes assumption, they predict the most probable estimated class:\n",
190192
"\\begin{align*}\n",
191193
"\\arg\\max_{y} \\mathbb{P}(Y=y|X=x) & = \\arg\\max_{y} \\frac{\\prod\\limits_{i=1}^n \\mathbb{P}(X_i=x_i|Y=y) \\mathbb{P}(Y=y)}{\\mathbb{P}(X=x)}\\\\\n",
@@ -433,6 +435,8 @@
433435
"metadata": {},
434436
"outputs": [],
435437
"source": [
438+
"Xtrain, ytrain, Xtest, ytest = shuffle_and_split(X,y,1000)\n",
439+
"\n",
436440
"print(Xtrain.shape)\n",
437441
"print(ytrain.shape)\n",
438442
"digits_nbc = GaussianNB()\n",

0 commit comments

Comments
 (0)