Skip to content

PyTorch implementation of Continuous Normalizing Flows (CNF) using TorchDyn to solve Density Estimation on the Two Moons dataset.

Notifications You must be signed in to change notification settings

Tejasvanvekar/neural_ode_continuous_flows

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Beyond Layers: Continuous Normalizing Flows with Neural ODEs

This repository contains the PyTorch implementation for training a Continuous Normalizing Flow (CNF) to solve density estimation on the "Two Moons" dataset. It utilizes the TorchDyn library to handle ODE integration and the Adjoint Sensitivity Method.

Read the Blog Series

This code accompanies my article series "Beyond Layers", where I explain the intuition and mathematics behind Neural ODEs.

Results

1. Generative Sampling (Reverse Flow)

Transforming a standard Gaussian distribution ($t=1$) back into the complex Two Moons data distribution ($t=0$) by integrating the learned vector field backward in time.

Flow Animation

(Above: A GIF of the learned flow carrying noise particles to the data manifold)

2. Learned Density

The model successfully learned a continuous probability density function that matches the geometry of the target dataset.

Target distribution

Target distribution

3. Training Convergence

The model minimizes the Negative Log-Likelihood (NLL) effectively over 250 epochs.

Loss Curve


Installation & Usage

  1. Clone the repository
    git clone https://github.com/vaishnavibiradar/beyond-layers-cnf.git
    cd beyond-layers-cnf

About

PyTorch implementation of Continuous Normalizing Flows (CNF) using TorchDyn to solve Density Estimation on the Two Moons dataset.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%