Created
August 26, 2020 08:16
-
-
Save mdouze/9eb96d941c94ef59482a069e5862a650 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"import numpy as np\n", | |
"import faiss\n", | |
"from matplotlib import pyplot" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def get_dataset_2(d, nt, nb, nq):\n", | |
" \"\"\"A dataset that is not completely random but still challenging to\n", | |
" index\n", | |
" \"\"\"\n", | |
" d1 = 10 # intrinsic dimension (more or less)\n", | |
" n = nb + nt + nq\n", | |
" rs = np.random.RandomState(1338)\n", | |
" x = rs.normal(size=(n, d1))\n", | |
" x = np.dot(x, rs.rand(d1, d))\n", | |
" # now we have a d1-dim ellipsoid in d-dimensional space\n", | |
" # higher factor (>4) -> higher frequency -> less linear\n", | |
" x = x * (rs.rand(d) * 4 + 0.1)\n", | |
" x = np.sin(x)\n", | |
" x = x.astype('float32')\n", | |
" return x[:nt], x[nt:nt + nb], x[nt + nb:]" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# K-means with initialization" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Generate training sets" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"xt1, xt2, _ = get_dataset_2(32, 10000, 10000, 0)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Initial training" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"km = faiss.Kmeans(32, 200, niter=25)\n", | |
"km.train(xt1)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 17, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZgAAAEHCAYAAACTC1DDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3deZxcVZn/8U9tne50SHcWIIAQAiqCYHT4AWISaQyoIMhPlmcYgiNBRgF1QBQHlxFBkXEhoOBgRBEH5CfPBBEY2UxDEUAniUEWDcgeMIsJ2TtJb1X1+6NPJZVKdXeluqsq3fV9v1796qpT5957nm7SD+eec8+JZDIZREREBlu02g0QEZHhSQlGRETKQglGRETKQglGRETKQglGRETKIl7tBlRTa2urptCJiJRg+vTpkf7q1HSCoeeHVNJxyWSSlpaWQW/PUFHL8Sv22oydGo8/N/bW1taijtEtMhERKQslGBERKQslGBERKQslGBERKQslGBERKQslGBERKQslGBERKQslmBKs2dTJ8s16RlNEpC9KMCV4eul6HlyqBCMi0peKPMlvZocCdwPXuvsNZrYv8HMgAXQBZ7v7CjPrAp7IOXR6SIK3ABOBFDDT3V8xs8nAjUAGeMbdLwjXuhQ4I5Rf4e73DXY8zSMTbOoe7LOKiAwvZe/BmFkjcD2Qu7bAt4CfuPsxwF3AJaF8vbu35HylgLOAde4+FbgKuDrUvQ64yN2nAE1mdoKZTQLOBKYCJwGzzCw22DE11SfYrAQjItKnStwi6wBOBJbllF0I3BlerwLG9XH89JCEAOYCU8ysDpjk7gtD+b3AccCxwP3u3unuq4AlwCGDHVBzg3owIiL9KfstMnfvBrrNLLdsEz29mxjwGeDK8FG9mf0S2B+4091nARNCEsLd02aWCWVrcy6zEtgLWJ2tm1f+bG/tSyaTOx1TKpNhc3eGhx95hGik3wVF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hICFknAie6+3WhlzINOBQ4OGzm9I/ufm/osfzA3b+Qd71vA2vd/SBgKnChmU3N+fyd7v6esDnUt80sFp4+X+fuBwNvB7qBd1bo5yM1TAlGZHB9GEi6e3adphuBj4Y/9ADzs0ucu/udwP9x9y53bw+7JR7Q+6kB+Ajwn+H4NcCvgQ/mfH5r+P5kWM5kj7C0+tFm9kEg5u4XuPtTgx65SB6NwYgMrmbg/Wb2fE7ZemBceJ1dNBEz2x243sz+IaxrNwG4rp/z7x42gMpaG1b0zr0W7p4Ke7jEwu6LY8OEhHeY2W3AJcN1q1/ZdSjBiAyuZcDcQttKF9i066qwgORh7t5hZr8s4vx/D8nq9fB+XCjrk7vPBmab2T7AnWGs5qZigxIphW6RiQxcV+i5ELZzmJZd1tzMjjSzH/Ry3B7AsyG5TAamAKMKnDPXb4FPhXOPD0vG/7avxpnZv5vZuWzb0+fV4b5RluwalGBEBu4h4ANmttDdlwH/AtxlZs+FCQB39HLcNcD5od5ngC8A55nZGWG/9/PNbE7eMV8FxoRbcPOAq8N06b7cCnzczP4ajuvMGasRKRtNUxYRkbJQD0ZERMpCCUZERMpCCUZERMpCCUZERMpCCUZERMpCCUZERMpCCUZERMpCCUZERMri/wOONcGTmzfaKgAAAABJRU5ErkJggg==\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"bento_obj_id": "139742568626384", | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"pyplot.plot(km.obj)\n", | |
"pyplot.xlabel('iterations')\n", | |
"pyplot.ylabel('k-means objective')\n", | |
"pyplot.grid(True)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Fine-tuning with warm-start from initial training" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 18, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"km2 = faiss.Kmeans(32, 200, niter=10)\n", | |
"km2.train(xt2, init_centroids=km.centroids)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 40, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAEHCAYAAACJN7BNAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nO3deZycdZXv8U91dVd3upvsQBZCNpDdqFwETAKtARUEvcNyhhEXgo4K6oCMzMVxRUVmXIC54AA6Ig7qXM6ADKCsaVIGUEMMJgRD2MKaBLI36U7SS1XdP+pXodJUdyqVWrpS3/frlVdX//p5njr1QPrktzy/E0mlUoiIiOypukoHICIiewclFBERKQolFBERKQolFBERKQolFBERKYr6SgdQSe3t7VriJiJSgDlz5kT6t9V0QiF9Uwo6Lx6P09bWVvR4Skkxl161xYtiLptqi3mweNvb23O2a8hLRESKQglFRESKQglFRESKQglFRESKQglFRESKQglFRESKQglFRESKQgmlABu7enhtq56JFBHJpoRSgCWvbub+VUooIiLZyvKkvJkdCdwJXO3u15nZJODnQAPQC3zM3V8zs17g0axT54SkdzMwGUgAc919pZnNAK4HUsAT7n5BeK9LgbND++Xufk+xP09LYz3bk8W+qohIdSt5D8XMWoBrgexn9b8L/MTdTwTuAC4J7R3u3pb1JwF8FNjs7rOAK4Arw7HXABe5+0xghJmdYmZTgXOAWcBpwFVmFi32Z2qJRelOFPuqIiLVrRxDXt3AqcDqrLYLgdvD63XAmEHOnxOSDsA8YKaZxYCp7r4otN8NnAS8F7jX3XvcfR3wEnB4sT9QS2M925VQRER2UvIhL3fvA/rMLLuti3TvJQp8Hvh2+FGTmf0KmALc7u5XAeNC0sHdk2aWCm2bst5mLTAe2JA5tl/7soHii8fju/2ZOnpSbOtLFnRuJXV2dirmEqu2eFHMZVNtMRcSb8V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u6mZ1PqI0DvDBUCzxJdVNCEdlzDwDvM7NF7r4a+HvgDjN7KkzY3zrAeT8CPheO+3yoR/FpMzs71B3/nJnd1u+crwKjwpDaAuDKsHx5MLcAHzezp8N5PVlzLSJFo2XDIiJSFOqhiIhIUSihiIhIUSihiIhIUSihiIhIUSihiIhIUSihiIhIUSihiIhIUSihiIhIUfx/A2vyAzLHeX0AAAAASUVORK5CYII=\n", | |
"text/plain": [ | |
"<Figure size 432x288 with 1 Axes>" | |
] | |
}, | |
"metadata": { | |
"bento_obj_id": "139742544453264", | |
"needs_background": "light" | |
}, | |
"output_type": "display_data" | |
} | |
], | |
"source": [ | |
"pyplot.plot(np.hstack((km.obj, km2.obj)))\n", | |
"pyplot.xlabel('iterations')\n", | |
"pyplot.ylabel('k-means objective')\n", | |
"pyplot.grid(True)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Initialization for IVF quantizer" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"This is more involved because the clusters cannot be set directly. However, we can do the training process manually. " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 23, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"xt, xb, xq = get_dataset_2(32, 10000, 10000, 100)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"We want to initialize with this" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 36, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"init_centroids = xb[:200]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 25, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"index = faiss.index_factory(32, 'PCA16,IVF200,Flat')" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Train VectorTransform manually" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 42, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"pca = index.chain.at(0)\n", | |
"pca.train(xt)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Manual k-means" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 47, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"km = faiss.Kmeans(16, 200)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 50, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"49671.68359375" | |
] | |
}, | |
"execution_count": 50, | |
"metadata": { | |
"bento_obj_id": "139742942267408" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"init_centroids_pca = pca.apply_py(init_centroids)\n", | |
"xt_pca = pca.apply_py(xt)\n", | |
"km.train(xt_pca, init_centroids=init_centroids_pca)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Set the centroids manually" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 44, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"index_ivf = faiss.downcast_index(faiss.extract_index_ivf(index))\n", | |
"index_ivf.quantizer.add(km.centroids)\n", | |
"index.is_trained = index_ivf.is_trained = True" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Now the index is ready" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 53, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"index.add(xb)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 55, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"(array([[4.6906796, 5.5750985],\n", | |
" [2.8803923, 3.8141544],\n", | |
" [4.432521 , 4.4821587],\n", | |
" [3.9308074, 4.6096234]], dtype=float32), array([[2080, 8407],\n", | |
" [4281, 1780],\n", | |
" [2927, 8969],\n", | |
" [2089, 9907]]))" | |
] | |
}, | |
"execution_count": 55, | |
"metadata": { | |
"bento_obj_id": "139742558282528" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"index.search(xq[:4], 2)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"bento_stylesheets": { | |
"bento/extensions/flow/main.css": true, | |
"bento/extensions/kernel_selector/main.css": true, | |
"bento/extensions/kernel_ui/main.css": true, | |
"bento/extensions/new_kernel/main.css": true, | |
"bento/extensions/system_usage/main.css": true, | |
"bento/extensions/theme/main.css": true | |
}, | |
"kernelspec": { | |
"display_name": "faiss", | |
"language": "python", | |
"name": "bento_kernel_faiss" | |
}, | |
"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.7.5+" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment