Skip to content

Jeong-Eul/NeuralSplineFlow-1D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Spline Flow for 1 dimension probability density estimation

The easiest way to get started with this code is by checking out the notebook tutorial.ipynb. This tutorial outlines the process of estimating the distribution of potential outcomes for a specific treatment option by first clustering the potential outcome dataset based on each patient's tumor volume at previous time points. Patients are grouped according to the severity of their condition, and a specific patient subgroup is then selected for detailed analysis.

This is a PyTorch implementation of Neural Spline Flow for 1D distributions, extended from the original paper "Neural Spline Flows" by Conor Durkan et al.

The example dataset used in this repository is data/processed_potential_outcomes.csv, which contains the potential outcomes of cancer volume under different treatment options:

1: Not treated

2: Chemotherapy only

3: Radiotherapy only

4: Chemotherapy + Radiotherapy

In the example below, I implemented a toy distribution to verify that 1D Neural Spline Flow can still capture complex distributional shapes. The number of bins is set to 10 for all experiments. The learning rate, number of iterations, and other hyperparameters are defined in the script file nf_spline.sh. To reproduce the results, simply set the hyperparameters in nf_spline.sh and run the script.

These toy experiments demonstrate the flexibility of normalizing flows by showing how they can transform a standard Gaussian into various complex target distributions, including skewed distributions, mixtures, and sinusoidal patterns with noise.

Animations of the learned potential outcome distributions are included to visualize how the normalizing flow gradually expands and contracts the input space to match the desired target density. By feeding samples from a standard Gaussian into the trained flow network, we can generate new samples from the target distribution.

Skewed Mixture Sin+Noise
alt text alt text alt text
Control (Not treated) Treatment (Chemo+Radio) Result
alt text alt text alt text

About

Pytorch Implementation of NeuralSplineFlow 1D

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published