{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 02. Neural Network Classification with PyTorch\n", "\n", "## TK - What we're going to cover\n", "\n", "TODO\n", "* Simple classification (reiterate PyTorch workflow)\n", " * Binary classification\n", " * Multi-class classification\n", "* Writing device agnostic code\n", " * Data on GPU\n", " * Model on GPU\n", "* More advanced classification (e.g. black and white images or FashionMNIST or FoodMNIST or something)\n", "* Visualizing a PyTorch model (all of the different connections)\n", "\n", "\n", "## TK - How you can use this notebook\n", "\n", "## TK - Architecture of a classification network" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## TK - Make data" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from sklearn.datasets import make_moons\n", "\n", "# Make 1000 samples \n", "n_samples = 1000\n", "\n", "# Create circles\n", "X, y = make_moons(n_samples,\n", " noise=0.07,\n", " random_state=42) # keep random state so we get the same values" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | X1 | \n", "X2 | \n", "label | \n", "
|---|---|---|---|
| 0 | \n", "-0.033411 | \n", "0.421391 | \n", "1 | \n", "
| 1 | \n", "0.998827 | \n", "-0.442890 | \n", "1 | \n", "
| 2 | \n", "0.889592 | \n", "-0.327843 | \n", "1 | \n", "
| 3 | \n", "0.341958 | \n", "-0.417690 | \n", "1 | \n", "
| 4 | \n", "-0.838531 | \n", "0.532375 | \n", "0 | \n", "