From e679c8567b93f1bf3b5e0ac324395c253b3d1347 Mon Sep 17 00:00:00 2001 From: Matthieu Thiboust <14574229+mthiboust@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:59:52 +0100 Subject: [PATCH] remove too specific notebook --- notebooks/mexican_hat.ipynb | 150 ------------------------------------ 1 file changed, 150 deletions(-) delete mode 100644 notebooks/mexican_hat.ipynb diff --git a/notebooks/mexican_hat.ipynb b/notebooks/mexican_hat.ipynb deleted file mode 100644 index 05f6308..0000000 --- a/notebooks/mexican_hat.ipynb +++ /dev/null @@ -1,150 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 27, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "
\n", - "" - ], - "text/plain": [ - "alt.LayerChart(...)" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "import somap as smp\n", - "from jaxtyping import Array, Float\n", - "\n", - "# Load the MNIST dataset as a Numpy array of shape (60000, 28, 28)\n", - "data = smp.datasets.MNIST().data\n", - "\n", - "\n", - "# Define our custom SOM with a Mexican Hat neighborhood distance\n", - "class MexicanHatSomParams(smp.AbstractSomParams):\n", - " sigma: float | Float[Array, \"...\"]\n", - " alpha: float | Float[Array, \"...\"]\n", - "\n", - "\n", - "class MexicanHatSom(smp.AbstractSom):\n", - " @staticmethod\n", - " def generate_algo(p: MexicanHatSomParams) -> smp.SomAlgo:\n", - " return smp.SomAlgo(\n", - " f_dist=smp.EuclidianDist(),\n", - " f_nbh=smp.MexicanHatNbh(sigma=p.sigma),\n", - " f_lr=smp.ConstantLr(alpha=p.alpha),\n", - " f_update=smp.SomUpdate(),\n", - " )\n", - "\n", - "\n", - "# Initialize the 2D map\n", - "model = MexicanHatSom(\n", - " shape=(11, 13),\n", - " topography=\"hex\",\n", - " borderless=False,\n", - " input_shape=(28, 28),\n", - " params=MexicanHatSomParams(sigma=0.2, alpha=0.005),\n", - ")\n", - "\n", - "# Train (see documentation to understand the \"bu_v\" dict key)\n", - "model, aux = smp.make_steps(model, {\"bu_v\": data})\n", - "\n", - "# Plot the 2D map\n", - "smp.plot(model, img_inverted_colors=True)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": ".venv", - "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.11.6" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -}