Skip to content

imruljubair/A-DSL-for-Mathematical-Exploration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Inside the MLP: A Domain Specific Language for Mathematical Exploration

This is a prototype of a domain-specific language (DSL) that helps users see and understand the inner mathematics of multilayer perceptrons (MLPs) through matrix representations and visual projections.

image

🧠 Visualizing MLPs Through Matrices and Code

Using a simple syntax such as:

mlp_byhand y = 5 | 4 -> 5 -> 7 -> 3 -> 2

Users can describe the data flow and layer transformations of an MLP.

  • 5 → number of input features (e.g., pixels of an image).
  • 4 → number of samples (e.g., images in a batch).
  • Each arrow -> defines how one feature space is linearly projected into another (e.g., 5 -> 7 transforms a 5-dimensional feature space into 7 dimensions through a weight matrix).

abhdsl

The program automatically generates interactive visualizations showing:

  • 🧩 Matrix views — each layer’s transformation represented by color-coded weight matrices and resulting activations. It utilizes Prof. Tom Yeh's framework to present the maths behind AI, widely knowns as AI by Hand.
  • 🔗 Network graph — a structural view of neurons and their connections.
  • 💻 Code view — the equivalent PyTorch implementation for direct experimentation.

🎯 How to use

Open this Google Colab and play! See this tutorial video.

abh-dsl.mp4

🎯 Who Is This For

  • Students exploring how MLPs transform data through matrix multiplications.
  • Educators seeking visual, interactive ways to teach linear layers and activations.
  • Researchers & developers wanting to debug or introspect the hidden computations of small neural networks.

🚀 Why It Matters

Neural networks are often treated as black boxes. The work opens that box by showing how every linear projection, activation, and feature transformation is realized through matrices.
It makes abstract math visible, helping users connect deep learning theory with actual data flow.

By bridging symbolic representation → matrix computation → executable PyTorch code,
This transforms the learning of MLPs from a theoretical concept into a hands-on, visual experience.

About

This is a prototype of a domain-specific language (DSL) that helps users see and understand the inner mathematics of multilayer perceptrons (MLPs) through matrix representations and visual projections.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors