{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# All the Linear Algebra You Need for AI" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The purpose of this notebook is to serve as an explanation of two crucial linear algebra operations used when coding neural networks: matrix multiplication and broadcasting." ] }, { "cell_type": "markdown", "metadata": { "heading_collapsed": true }, "source": [ "## Introduction" ] }, { "cell_type": "markdown", "metadata": { "hidden": true }, "source": [ "**Matrix multiplication** is a way of combining two matrices (involving multiplying and summing their entries in a particular way). **Broadcasting** refers to how libraries such as Numpy and PyTorch can perform operations on matrices/vectors with mismatched dimensions (in particular cases, with set rules). We will use broadcasting to show an alternative way of thinking about matrix multiplication from, different from the way it is standardly taught." ] }, { "cell_type": "markdown", "metadata": { "hidden": true }, "source": [ "In keeping with the [fast.ai teaching philosophy](http://www.fast.ai/2016/10/08/teaching-philosophy/) of [\"the whole game\"](https://www.amazon.com/Making-Learning-Whole-Principles-Transform/dp/0470633719/ref=sr_1_1?ie=UTF8&qid=1505094653), we will:\n", "\n", "- first use a pre-defined class for our neural network\n", "- then define the net ourselves to see where it uses matrix multiplication & broadcasting\n", "- and finally dig into the details of how those operations work\n", "\n", "This is different from how most math courses are taught, where you have to learn all the individual elements before you can combine them (Harvard professor David Perkins call this *elementitis*), but it is similar to how topics like *driving* and *baseball* are taught. That is, you can start driving without [knowing how an internal combustion engine works](https://medium.com/towards-data-science/thoughts-after-taking-the-deeplearning-ai-courses-8568f132153), and children begin playing baseball before they learn all the formal rules.\n", "\n", "\n", "