{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Classifying handwritten digits using the SVD" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Load data from the MNIST data set" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [], "source": [ "using Flux\n", "using Flux.Data.MNIST" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [], "source": [ "labels = MNIST.labels();\n", "images = MNIST.images(); " ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/.julia/environments/v1.0/Project.toml`\n", "\u001b[90m [no changes]\u001b[39m\n", "\u001b[32m\u001b[1m Updating\u001b[22m\u001b[39m `~/.julia/environments/v1.0/Manifest.toml`\n", "\u001b[90m [no changes]\u001b[39m\n" ] } ], "source": [ "using Pkg\n", "Pkg.add(\"ImageShow\")" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [], "source": [ "using ImageShow" ] }, { "cell_type": "code", "execution_count": 100, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(60000,)" ] }, "execution_count": 100, "metadata": {}, "output_type": "execute_result" } ], "source": [ "size(images)" ] }, { "cell_type": "code", "execution_count": 102, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(28, 28)" ] }, "execution_count": 102, "metadata": {}, "output_type": "execute_result" } ], "source": [ "size(images[8])" ] }, { "cell_type": "code", "execution_count": 103, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "784" ] }, "execution_count": 103, "metadata": {}, "output_type": "execute_result" } ], "source": [ "28*28" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's see what the images look like:" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/html": [ "