diff --git a/lectures/lec19/Clustering.ipynb b/lectures/lec19/Clustering.ipynb
new file mode 100644
index 0000000..9e64dcf
--- /dev/null
+++ b/lectures/lec19/Clustering.ipynb
@@ -0,0 +1,434 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# CS429: Information Retrieval\n",
+ "\n",
+ "
\n",
+ "\n",
+ "## Lecture 19: Clustering\n",
+ "\n",
+ "
\n",
+ "\n",
+ "### Dr. Aron Culotta\n",
+ "### Illinois Institute of Technology"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "Recall classification problem notation:\n",
+ "\n",
+ "\n",
+ "- $\\vec{x} \\in \\mathcal{X}$ *instance*, *example*, *input*\n",
+ " - e.g., an email\n",
+ "- $y \\in \\mathcal{Y}$ *target*, *class*, *label*, *output*\n",
+ " - e.g., $y=1$: spam ; $y=-1$: not spam\n",
+ "- $f: \\mathcal{X} \\mapsto \\mathcal{Y}$ *hypothesis*, *learner*, *model*, *classifier*\n",
+ " - e.g., if $x$ contain the word *free*, $y$ is $1$."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "** Training data:**\n",
+ "\n",
+ "We are given training data $D = \\{(\\vec{x}_1, y_1), \\ldots, (\\vec{x}_n, y_n)\\}$\n",
+ "\n",
+ "||free|money| |*label*|\n",
+ "|:--:|:--------:|:--------:|:--:|:--:|\n",
+ "||$x_{i1}$|$x_{i2}$| | $y_i$ |\n",
+ "|$x_1$|0|0||-1| \n",
+ "|$x_2$|1|0|| 1|\n",
+ "|$x_3$|1|1||-1|\n",
+ "|$x_4$|1|0||-1|\n",
+ "|$x_5$|1|1||1|\n",
+ "|$x_6$|0|0||1|\n",
+ "|$x_7$|0|1||-1|\n",
+ "\n",
+ "How to classify a new instance? \n",
+ " \"free money\" -> $\\{1,1\\}$\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**In clustering, we don't get any labels!**\n",
+ "\n",
+ "\n",
+ "||free|money| |*label*|\n",
+ "|:--:|:--------:|:--------:|:--:|:--:|\n",
+ "||$x_{i1}$|$x_{i2}$| | $y_i$ |\n",
+ "|$x_1$|0|0||?| \n",
+ "|$x_2$|1|0||?|\n",
+ "|$x_3$|1|1||?|\n",
+ "|$x_4$|1|0||?|\n",
+ "|$x_5$|1|1||?|\n",
+ "|$x_6$|0|0||?|\n",
+ "|$x_7$|0|1||?|"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**What can we possibly hope to learn using only X??**\n",
+ "\n",
+ "- **Patterns of features**: E.g., the terms \"free\", \"money\", and \"credit\" often appear together\n",
+ "- **Patterns of documents**: E.g., these 1,000 emails all look pretty similar\n",
+ "\n",
+ "
\n",
+ "**Why do this?**\n",
+ "- Helps the user explore/visualize data\n",
+ " - E.g., lawyers looking for criminal activity in [Enron emails](https://en.wikipedia.org/wiki/Enron_scandal)\n",
+ " - Bioligists looking for patterns in DNA\n",
+ "- May help as a preprocessing step for supervised learning\n",
+ " - Reduce dimensionality of feature vectors\n",
+ " - Provide more predictive features than raw features"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**Today**: Document clustering\n",
+ "\n",
+ "**Types of document clustering**:\n",
+ "\n",
+ "- Flat clustering\n",
+ "\n",
+ "![flat](images/clustering.gif)\n",
+ "[source](http://home.deib.polimi.it/matteucc/Clustering/tutorial_html/images/clustering.gif)\n",
+ "\n",
+ "
\n",
+ "\n",
+ "- Hierarchical clustering\n",
+ "\n",
+ "![hclust](images/hclust.png)\n",
+ "[source](http://cs.jhu.edu/~razvanm/fs-expedition/tux3.html)\n",
+ "\n",
+ "
\n",
+ "\n",
+ "- Hard vs. soft clustering\n",
+ "![soft](images/soft.png)\n",
+ "[source](http://home.deib.polimi.it/matteucc/Clustering/tutorial_html/images/clustering.gif)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**Flat Clustering: Problem statement**\n",
+ "\n",
+ "Input:\n",
+ "- documents $D = \\{d_1 \\ldots d_N\\}$\n",
+ "- desired number of clusters $K$\n",
+ "- **objective function** that evaluates quality of clustering\n",
+ "\n",
+ "Output:\n",
+ "- An assignment $\\gamma : D \\rightarrow \\{1, \\ldots, K\\}$ that optimizes the objective function"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**Similar to our gradient descent recipe:**\n",
+ "\n",
+ "1. pick a model\n",
+ "2. pick an error function\n",
+ "3. minimize that error function"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**But**, what is a good objective function?\n",
+ "\n",
+ "
"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**K-Means**\n",
+ "- Identify $K$ **cluster centers**\n",
+ "- Minimize distance from each document to its assigned cluster center.\n",
+ "\n",
+ "![kmeans](images/kmeans.png)\n",
+ "[source](http://blog.mpacula.com/2011/04/27/k-means-clustering-example-python/)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "- Each cluster center represented by one **mean vector** $ \\in \\{\\mu_1 \\ldots \\mu_K\\}$\n",
+ " - $\\mu_i \\in \\mathbb{R}^V$ if $V$ terms in vocabulary\n",
+ "- Each document $x$ associated with exactly one mean vector (hard clustering)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**K-Means** Algorithm Overview\n",
+ "\n",
+ "1. Pick $K$ mean vectors at random\n",
+ "2. Iterate until convergence:\n",
+ " 1. Assign each document $x_i$ to its closest mean vector $\\mu_j$\n",
+ " 2. Update each mean vector $\\mu_j$ to be the mean of the $x_i$'s assigned to it"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**K-means objective**\n",
+ "\n",
+ "- Let $M = \\{\\mu_1 \\ldots \\mu_K\\}$ be the set of mean vectors.\n",
+ "- Let $r_{ij} = 1$ if $x_i$ belongs to cluster $j$, otherwise 0.\n",
+ "\n",
+ "$$E(D, M) = \\sum_{i=1}^N \\sum_{j=1}^K r_{ij} d(x_i, \\mu_j)$$\n",
+ "\n",
+ "= \"sum of distances from each document to its assigned cluster center.\"\n",
+ "\n",
+ "So, optimal clustering is:\n",
+ "\n",
+ "$$M^* \\leftarrow \\mathop{\\rm argmin}_M E(D, M)$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**Distance $d$?**\n",
+ "\n",
+ "E.g., Euclidean:\n",
+ "\n",
+ "$$d(x_i, \\mu_j) = \\sqrt{\\sum_{p=1}^V (x_{ip} - \\mu_{jp})^2}$$\n",
+ "\n",
+ "E.g.:\n",
+ "\n",
+ "- $x_i = \\{1,2,3\\}$\n",
+ "- $\\mu_j = \\{1, 4, 1\\}$\n",
+ "- $d(x_i, \\mu_j) = \\sqrt{(1-1)^2 + (2-4)^2 + (3-1)^2} = 8$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**K-Means** is a **greedy** algorithm to minimize $E$\n",
+ "\n",
+ "![kmeansalg](images/kmeansalg.png)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**Not guaranteed to find global optimum!**\n",
+ "\n",
+ "![nonconvex](images/nonconvex.png)\n",
+ "[source](http://sebastianraschka.com/faq/docs/visual-backpropagation.html)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**K-Means is sensitive to initialization**"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 42,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAewAAAEKCAYAAADQN2b/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAEQBJRE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bMa\nMy8/CDizd3RfBX6ambdWHaRTZebHM/OUzJzNwO/S/Zn5Z1Xn6kSNIcunIuL3Gqv+ECfqjeZnwPkR\nMS0igoH95OS84UaOZt0D/EVj+c+Bjj7A6Ko6QCky80BEXA+sZeAPndsz0/8ZRoiIecCHgMci4hEG\nhpg+npnfrjaZCvdR4OsRcRzwBLCo4jwdJzN/3Bil+SFwAHgE+HK1qTpHRKwEakB3RGwDlgE3A3dH\nxF8CW4Erq0s4Nr+aVJKkAjgkLklSASxsSZIKYGFLklQAC1uSpAJY2JIkFcDCliSpABa2dAxqXI7y\nwxP4evdGxB4vEyq1j4UtHZteBywe75Ma35B1OD4D/MlhPldSCyxs6dj0aWB24+pWtwBExN9GxMaI\neDQiljXWzYqI/oi4MyIeA94UEc9FxGci4j8iYm1EvDMi6hGxJSLeN9qLZeYDgBd5kdrIwpaOTUuB\nxzPz7My8KSLmA3My8zzgHcA5EfGuxrZvAb6QmW/LzG3ADGBdZs5loIQ/CVwG/DHw9xP+k0gC/C5x\nabLoAeZHxI8YuPjBDGAOA9d435qZ3x+y7YuZubax/Bjwm8x8uXEEPmsiQ0t6hYUtTQ4BfDoz/3HY\nyohZwAsjtt0/ZPll4EWAzMzGpVMlVcAhcenY9BzwmiH3+4C/jIgZABFxUkT8TuOxkRPNmk08G+ux\nw520JmkM/rUsHYMy85mIeCgiNgH3Ns5jnw78v8ZE8OcYmNX9MgOXQB329Gb/9GgrI+JB4DRgZuPS\nhddm5n1H+nNIeoWX15QkqQAOiUuSVAALW5KkAljYkiQVwMKWJKkAFrYkSQWwsCVJKoCFLUlSASxs\nSZIK8P8B+U55dyp0QssAAAAASUVORK5CYII=\n",
+ "text/plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "import matplotlib.pyplot as plt\n",
+ "%matplotlib inline\n",
+ "\n",
+ "plt.figure(figsize=(8,4))\n",
+ "plt.scatter([0,0], [0, 1], color='b')\n",
+ "plt.scatter([10,10], [0, 1], color='r', marker='^')\n",
+ "plt.xlim(-1, 11)\n",
+ "plt.ylim(-1, 11)\n",
+ "plt.xlabel('term 1')\n",
+ "plt.ylabel('term 2')\n",
+ "plt.show()\n",
+ "\n",
+ "plt.figure(figsize=(8,4))\n",
+ "plt.scatter([0,0], [0, 1], color='b')\n",
+ "plt.scatter([10,10], [0, 1], color='r', marker='^')\n",
+ "plt.annotate('$\\mu_1$', xy=(5,1), size=20)\n",
+ "plt.scatter([5], [1], color='k')\n",
+ "plt.annotate('$\\mu_2$', xy=(5,0), size=20)\n",
+ "plt.scatter([5], [0], color='k')\n",
+ "plt.xlim(-1, 11)\n",
+ "plt.ylim(-1, 11)\n",
+ "plt.xlabel('term 1')\n",
+ "plt.ylabel('term 2')\n",
+ "plt.show()\n",
+ "\n",
+ "plt.figure(figsize=(8,4))\n",
+ "plt.scatter([0,10], [1, 1], color='b')\n",
+ "plt.scatter([0,10], [0, 0], color='r', marker='^')\n",
+ "plt.annotate('$\\mu_1$', xy=(5,1), size=20)\n",
+ "plt.scatter([5], [1], color='k')\n",
+ "plt.annotate('$\\mu_2$', xy=(5,0), size=20)\n",
+ "plt.scatter([5], [0], color='k')\n",
+ "plt.xlim(-1, 11)\n",
+ "plt.ylim(-1, 11)\n",
+ "plt.xlabel('term 1')\n",
+ "plt.ylabel('term 2')\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**Simple solution**\n",
+ "- Run K-Means many times with different initialization\n",
+ " - pick one with lowest cost\n",
+ " \n",
+ "OR\n",
+ "\n",
+ "- Pick initial means to be well-dispersed in data\n",
+ " - E.g., Each mean is set to an some existing point\n",
+ " - To pick new mean, pick a point $x$ that is far away from all other previously selected points\n",
+ " "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "**How to pick K?**\n",
+ "\n",
+ "
\n",
+ "Look for the knee!\n",
+ "![knee](images/knee.png)\n",
+ "\n",
+ "E.g., at K=4 and K=9"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "How do we know k-means actually minimizes the error function?\n",
+ "\n",
+ "We can compute gradient w.r.t. $M$, just like we did for logistic regression.\n",
+ "\n",
+ "$$E(D, M) = \\sum_{i=1}^N \\sum_{j=1}^K r_{ij} d(x_i, \\mu_j)$$\n",
+ "\n",
+ "$$\\frac{\\partial E(D, M)}{\\partial \\mu_{jp}} = \\sum_{x_i \\in C_j} 2(\\mu_{jp} - x_{ip}) $$\n",
+ "where $C_j$ is the set of documents assigned to cluster $j$\n",
+ "\n",
+ "Setting this derivative to zero, we get the following update:\n",
+ "\n",
+ "$$\\mu_{jp} = \\frac{1}{|C_j|} \\sum_{x_i \\in C_j} x_{ip}$$\n",
+ "\n",
+ "which is just the average frequency of term $p$ for documents in cluster $j$."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEACAYAAACwB81wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAE6NJREFUeJzt3HuQXOWZ3/HvA7KQuAQHsSggMCkjHMdcgrcwERijBu9K\ns+tssENswFuEVQErF4ZQFVUijLOlwZWL9YfKl6I2HmkVIC6rZJcMtQKCRhjUC1qWXcU2YK9nLIzL\nAglZsbN4Y8EYC/Hkj25PBjGXHvrM9Ey/309Vl/qc8/R5n1N99Jszb/eZyEwkSd3vqE43IEmaHga+\nJBXCwJekQhj4klQIA1+SCmHgS1IhKgn8iNgYEQci4tkxtn8yIp5pPnZGxHlVjCtJal1VV/h3A8vH\n2f5j4LLM/GfAfwI2VDSuJKlFc6rYSWbujIgzx9n+1IjFp4BFVYwrSWpdJ+bwbwQe7sC4klS0Sq7w\nWxURlwMrgEunc1xJ0jQGfkScD6wHejLz5XHq/OM+kjRJmRkT1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plain": [
+ ""
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "# Here's an example. \n",
+ "# Exercise: work out the means/cluster assignments\n",
+ "# until convergence.\n",
+ "def plot(points, cluster_assignments, means):\n",
+ " plt.figure()\n",
+ " for point, asg in zip(points, cluster_assignments):\n",
+ " plt.scatter([point[0]], [point[1]], marker='o' if asg==1 else '^')\n",
+ " for i, m in enumerate(means):\n",
+ " plt.annotate('$\\mu_%d$' % i, xy=m, size=20)\n",
+ " plt.scatter([m[0]], [m[1]], color='k')\n",
+ " plt.show()\n",
+ " \n",
+ "plot([(0, 0), (0, 1), (2, 0), (3,1), (3,0)], [0,0,0,1,1], [(1,0), (4,0)])"
+ ]
+ }
+ ],
+ "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.5.0"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
diff --git a/lectures/lec19/images/clustering.gif b/lectures/lec19/images/clustering.gif
new file mode 100644
index 0000000..e1e9703
Binary files /dev/null and b/lectures/lec19/images/clustering.gif differ
diff --git a/lectures/lec19/images/hclust.png b/lectures/lec19/images/hclust.png
new file mode 100644
index 0000000..e39e20c
Binary files /dev/null and b/lectures/lec19/images/hclust.png differ
diff --git a/lectures/lec19/images/kmeans.png b/lectures/lec19/images/kmeans.png
new file mode 100644
index 0000000..a54699a
Binary files /dev/null and b/lectures/lec19/images/kmeans.png differ
diff --git a/lectures/lec19/images/kmeansalg.png b/lectures/lec19/images/kmeansalg.png
new file mode 100644
index 0000000..6469adb
Binary files /dev/null and b/lectures/lec19/images/kmeansalg.png differ
diff --git a/lectures/lec19/images/knee.png b/lectures/lec19/images/knee.png
new file mode 100644
index 0000000..c26b9a3
Binary files /dev/null and b/lectures/lec19/images/knee.png differ
diff --git a/lectures/lec19/images/nonconvex.png b/lectures/lec19/images/nonconvex.png
new file mode 100644
index 0000000..896db0e
Binary files /dev/null and b/lectures/lec19/images/nonconvex.png differ
diff --git a/lectures/lec19/images/soft.png b/lectures/lec19/images/soft.png
new file mode 100644
index 0000000..4631c90
Binary files /dev/null and b/lectures/lec19/images/soft.png differ