diff --git a/examples/test.ipynb b/examples/test.ipynb index a969eae..833366a 100644 --- a/examples/test.ipynb +++ b/examples/test.ipynb @@ -4,14 +4,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Using FIt-SNE\n", + "# A brief guide to FIt-SNE. Visualizing MNIST\n", "\n", "Author: Dmitry Kobak" ] }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -21,25 +21,16 @@ "import pylab as plt\n", "import seaborn as sns; sns.set()\n", "\n", - "# change the path!\n", - "import sys; sys.path.append('/home/dmitry/github/kerind/FIt-SNE')\n", + "# the path should point to the FIt-SNE directory\n", + "import sys; sys.path.append('../')\n", "from fast_tsne import fast_tsne" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 17, "metadata": {}, "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/george/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n", - " from ._conv import register_converters as _register_converters\n", - "Using TensorFlow backend.\n" - ] - }, { "name": "stdout", "output_type": "stream", @@ -52,8 +43,8 @@ "# Load MNIST data\n", "from keras.datasets import mnist\n", "(x_train, y_train), (x_test, y_test) = mnist.load_data()\n", - "x_train = x_train.reshape(60000, 784).astype('float64') / 255\n", - "x_test = x_test.reshape(10000, 784).astype('float64') / 255\n", + "x_train = x_train.reshape(60000, 784).astype('float') / 255\n", + "x_test = x_test.reshape(10000, 784).astype('float') / 255\n", "X = np.concatenate((x_train, x_test))\n", "y = np.concatenate((y_train, y_test))\n", "print(X.shape)\n", @@ -63,9 +54,6 @@ "U, s, V = np.linalg.svd(X, full_matrices=False)\n", "X50 = np.dot(U, np.diag(s))[:,:50]\n", "\n", - "# We will use PCA initialization later on\n", - "PCAinit = X50[:,:2] / np.std(X50[:,0]) * 0.0001\n", - "\n", "# 10 nice colors\n", "col = np.array(['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99',\n", " '#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a'])" @@ -73,9 +61,17 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 15, "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CPU times: user 685 ms, sys: 84.2 ms, total: 769 ms\n", + "Wall time: 58.7 s\n" + ] + }, { "data": { "application/javascript": [ @@ -89,7 +85,7 @@ " } else if (typeof(MozWebSocket) !== 'undefined') {\n", " return MozWebSocket;\n", " } else {\n", - " alert('Your browser does not have WebSocket support.' +\n", + " alert('Your browser does not have WebSocket support. ' +\n", " 'Please try Chrome, Safari or Firefox ≥ 6. ' +\n", " 'Firefox 4 and 5 are also supported but you ' +\n", " 'have to enable WebSockets in about:config.');\n", @@ -306,7 +302,7 @@ "mpl.figure.prototype._init_toolbar = function() {\n", " var fig = this;\n", "\n", - " var nav_element = $('
')\n", + " var nav_element = $('
');\n", " nav_element.attr('style', 'width: 100%');\n", " this.root.append(nav_element);\n", "\n", @@ -363,7 +359,7 @@ " var fmt = mpl.extensions[ind];\n", " var option = $(\n", " '