Giter VIP home page Giter VIP logo

matmul_viz's Introduction

Matmul viz

Matmul viz is an interactive tool to help people gain intuition about matrix multiplication.

Matmul viz screen shot

It is based on A Programmer’s Intuition for Matrix Multiplication. In this article each matrix of the matmul contains either data or operations and the data is poured into the operations one column vector at a time. Each operation is a dot product (i.e. element wise multiplication and then a sum of the results). This result is then placed back below the original data, as new data.

This program takes something most people are familiar with, a receipt, and turns it into a matmul problem. Each shopper has a different shopping list, and they want to know which store they should shop at to spend the least amount of money. So we use a dot-product to multiply the number of items of each kind with the price of each kind of item. That gives us their receipt. The total of this receipt goes into the result matrix so now we have a matrix of shoppers vs stores and it's easy to see which store the shopper should shop at to get the lowest total.

This program visualizes all the intermediate steps that the matmul operation takes rather than hand waving the details away.

Additionally, it shows the output matrix in an orientation where it is clear why you can only multiply compatible matrices together. The number of rows of the data matrix must match the number of columns of the operations matrix.

Try it yourself! Click total cells to see their upstream dependencies and resize the input matrices to gain your own intuitions for why we need certain input dimensions to match while others are flexible!

evanburnette.github.io/matmul_viz

matmul_viz's People

Contributors

evanburnette avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.