ManimML: Visualizing Machine Learning Concepts with Manim Animations

This repository profile is provided by osrepos.com, an open source repository discovery platform.

ManimML: Visualizing Machine Learning Concepts with Manim Animations

Summary

ManimML is an open-source project that offers powerful animations and visualizations for common machine learning concepts, built upon the Manim Community Library. It aims to provide a compilation of primitive visualizations that can be easily combined to explain complex ML ideas, allowing users to focus on explanations rather than software engineering. The library simplifies the creation of engaging educational content for neural networks, convolutional layers, and more.

Repository Information

Analyzed by OSRepos on November 26, 2025

Topics

Click on any tag to explore related repositories

Use at your own risk

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.

Introdução

ManimML is a project dedicated to creating stunning animations and visualizations of common machine learning concepts using the Manim Community Library. The goal is to offer a collection of fundamental visualizations that can be readily combined to produce videos explaining intricate machine learning ideas. This project also provides abstractions, enabling users to concentrate on educational content rather than the underlying software engineering. ManimML has even been featured in a paper, highlighting its contribution to communicating machine learning architectures.

Instalação

To get started with ManimML, you first need to install the Manim Community edition. Ensure it's not the original 3Blue1Brown Manim version. You can find detailed installation instructions for Manim here.

Once Manim is installed, you can install ManimML via pip:


pip install manim_ml

Note that some recent features might only be available if you install directly from the source.

Exemplos

ManimML provides a straightforward way to visualize various machine learning architectures and processes. Here are some examples:

First Neural Network (Convolutional Neural Network) This example demonstrates how to visualize a Convolutional Neural Network and animate its forward pass.


from manim import *
from manim_ml.neural_network import Convolutional2DLayer, FeedForwardLayer, NeuralNetwork

config.pixel_height = 700
config.pixel_width = 1900
config.frame_height = 7.0
config.frame_width = 7.0

class BasicScene(ThreeDScene):
    def construct(self):
        nn = NeuralNetwork([
                Convolutional2DLayer(1, 7, 3, filter_spacing=0.32),
                Convolutional2DLayer(3, 5, 3, filter_spacing=0.32),
                Convolutional2DLayer(5, 3, 3, filter_spacing=0.18),
                FeedForwardLayer(3),
                FeedForwardLayer(3),
            ],
            layer_spacing=0.25,
        )
        nn.move_to(ORIGIN)
        self.add(nn)
        forward_pass = nn.make_forward_pass_animation()
        self.play(forward_pass)

To render this, save the code as example.py and run:


manim -pql example.py

Convolutional Neural Network

A Simple Feed Forward Network Visualize a basic feed-forward neural network by defining its layers.


from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer

nn = NeuralNetwork([
    FeedForwardLayer(num_nodes=3),
    FeedForwardLayer(num_nodes=5),
    FeedForwardLayer(num_nodes=3)
])
self.add(nn)

Simple Feed Forward Network

Animating the Forward Pass Automatically animate the data flow through your neural network.


from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer

nn = NeuralNetwork([
    FeedForwardLayer(num_nodes=3),
    FeedForwardLayer(num_nodes=5),
    FeedForwardLayer(num_nodes=3)
])
self.add(nn)
forward_pass_animation = nn.make_forward_pass_animation()
self.play(forward_pass_animation)

Animating Forward Pass

Convolutional Neural Networks with an Image Feed an image into a convolutional neural network and visualize its processing.


import numpy as np
from PIL import Image
from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer, Convolutional2DLayer, ImageLayer

image = Image.open("digit.jpeg") # You will need to download an image of a digit.
numpy_image = np.asarray(image)

nn = NeuralNetwork([
        ImageLayer(numpy_image, height=1.5),
        Convolutional2DLayer(1, 7, 3, filter_spacing=0.32),
        Convolutional2DLayer(3, 5, 3, filter_spacing=0.32),
        Convolutional2DLayer(5, 3, 3, filter_spacing=0.18),
        FeedForwardLayer(3),
        FeedForwardLayer(3),
    ],
    layer_spacing=0.25,
)
nn.move_to(ORIGIN)
self.add(nn)
forward_pass = nn.make_forward_pass_animation()

CNN with Image

Max Pooling Visualize the 2D Max Pooling operation, a common technique to reduce feature map sizes.


from manim_ml.neural_network import NeuralNetwork, Convolutional2DLayer, MaxPooling2DLayer

nn = NeuralNetwork([
        Convolutional2DLayer(1, 8),
        Convolutional2DLayer(3, 6, 3),
        MaxPooling2DLayer(kernel_size=2),
        Convolutional2DLayer(5, 2, 2),
    ],
    layer_spacing=0.25,
)
nn.move_to(ORIGIN)
self.add(nn)
forward_pass = nn.make_forward_pass_animation()
self.wait(1)
self.play(forward_pass)

Max Pooling

Activation Functions Illustrate different activation functions applied to neural network layers.


from manim_ml.neural_network import NeuralNetwork, Convolutional2DLayer, FeedForwardLayer

nn = NeuralNetwork([
        Convolutional2DLayer(1, 7, filter_spacing=0.32),
        Convolutional2DLayer(3, 5, 3, filter_spacing=0.32, activation_function="ReLU"),
        FeedForwardLayer(3, activation_function="Sigmoid"),
    ],
    layer_spacing=0.25,
)
self.add(nn)
forward_pass = nn.make_forward_pass_animation()
self.play(forward_pass)

Activation Functions

Neural Network Dropout Animate the dropout regularization technique in a neural network.


from manim_ml.neural_network import NeuralNetwork, FeedForwardLayer
from manim_ml.neural_network.animations.dropout import make_neural_network_dropout_animation

nn = NeuralNetwork([
        FeedForwardLayer(3),
        FeedForwardLayer(5),
        FeedForwardLayer(3),
        FeedForwardLayer(5),
        FeedForwardLayer(4),
    ],
    layer_spacing=0.4,
)
nn.move_to(ORIGIN)
self.add(nn)
self.play(
    make_neural_network_dropout_animation(
        nn, dropout_rate=0.25, do_forward_pass=True
    )
)
self.wait(1)

Neural Network Dropout

Porquê usar

ManimML stands out as an invaluable tool for anyone looking to create clear and engaging explanations of machine learning concepts. By leveraging the powerful Manim Community Library, it abstracts away much of the complexity of animation, allowing educators, researchers, and students to focus on the core ideas. Its modular design, with easily combinable primitive visualizations, makes it highly flexible for diverse educational content. Whether you're explaining basic neural networks or complex convolutional architectures, ManimML provides the visual clarity needed to enhance understanding.

Links

Source repository

Open the original repository on GitHub.

14 counted GitHub visits

View on GitHub
OS
OSRepos

Analysis and discovery of open source repositories. Find interesting projects and follow their updates.

Monitor your website with YourWebsiteScore

OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of third-party repository code is at your own risk. Always review source code, dependencies, licenses, and security implications before running anything.

© 2025 OSRepos. Built with Nuxt 3 and lots of ❤️