Giter Site home page Giter Site logo

ml-visualizer's Introduction

NumpyViz

NumpyViz is a code visualizer that renders dynamic visualizations for Numpy operations.

Overview

If you've ever struggled to understand multi-dimensional array operations -- furiously keeping track of the operation names, aligning dimensions, or visualizing transformations in your head -- you've come to the right place.

While there are lots of resources and documentation about HOW to use Numpy, there surprisingly isn't a lot of content for visual learners like me. I wanted something where I could blindly paste in some arcane matrix code and magically feel these operations, playing and controlling them in real-time.

This level of understanding and interactivity only had to come from a new tool. What was driven out of sheer need for deeper understanding led to NumpyViz.

What is it?

In NumpyViz, you can paste in arbitrary Numpy code and it will magically parse the code and return an ordered sequence of operations, complete with visual representations of each step.

This was built with Python, Next.js/Vercel, and Manim, a math animations library, for vizualizations.

I hope this project aims to develop a comprehensive tool for visualizing machine learning code, with the goal of providing an intuitive and educational way to see how machine learning algorithms, particularly those implemented in PyTorch or Numpy, manipulate data through various array operations.

Features

  • Real-time parsing of Numpy code
  • Step-by-step visualization of matrix operations
  • Support for a wide range of Numpy functions and operations
  • Interactive web interface for easy code input and visualization viewing

Getting Started

I couldn't host backend on cloud because manim animation rendering took too much memory and storage. So, just run the app locally.

Prerequisites

  • Python (version 3.9 or later)
  • Node.js (version 14 or later)
  • npm (usually comes with Node.js)
  • Git

Backend

  1. Clone the repository:
git clone https://github.com/rzhang139/numpyviz.git
cd numpyviz
  1. Set up a Python virtual environment

  2. Install the required Python packages:

cd backend
pip install -r requirements.txt
  1. Start the Flask server:
python app.py

The backend should now be running on http://localhost:5000

Frontend

  1. Open a new terminal window and navigate to the frontend directory:
cd frontend
  1. Install the required npm packages:
npm install
  1. Start the Next.js server:
npm run dev

The frontend should now be accessible at http://localhost:3000

Future Ideas

For anyone playing with this repo, please feel free to DM me on twitter if you run into any issues or would like to contribute

[ ] Robust parsing module (Handle syntax edge cases) [ ] User controls (video speed, quality, etc) [ ] Developing more visualization intuition around some tricker operations such as np.expand_dims() or np.squeeze() [ ] Support Pytorch operations [ ] Support OpenGL for faster rendering

ml-visualizer's People

Contributors

rrzhang139 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.