Skip to content

esyniawa/vis-manifolds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Neural Manifold Visualization

This repo provides Python examples for visualizing the manifolds.

Overview

python neural_manifolds.py

The visualization consists of two main components:

  1. A spike raster plot showing the firing patterns of three individual neurons
  2. A 3D trajectory plot showing the neural manifold (the path traced by the combined neural activity)

python umap_example.py Example of how to use UMAP for visualization of latent space.

  1. A neural network learns to classify MNIST digits
  2. Visualize the latent space using UMAP during training

Installation

  1. Create and activate a new conda environment:
conda create env create --name nengo --file env.yml
conda activate nengo
  1. Or install the required Python packages by yourself:
pip install numpy==1.26.3
pip install nengo==4.0.0
pip install matplotlib
  1. Install ffmpeg (for MP4 export):

On Ubuntu/Debian:

sudo apt-get install ffmpeg

On Conda:

conda install ffmpeg

Technical Details

Neural Network Configuration

  • Uses 3 Leaky Integrate-and-Fire (LIF) neurons
  • Each neuron has a different encoding vector aligned with one axis
  • Firing rates: 200-400 Hz
  • Membrane time constant (tau_rc): 0.02s
  • Synaptic filtering: 0.01s on input, 0.05s on output

Input Signal

  • Smooth circular trajectory in 3D space
  • Frequency: 0.5 Hz
  • Amplitude: 0.8
  • Third dimension phase-shifted by π/4

Visualization Features

  • Color-coded spike trains for each neuron
  • Gradient-colored trajectory showing time progression
  • Rotating 3D view for better spatial perception
  • 1-second sliding window for spike raster
  • Continuous looping animation

Outputs

The script generates two animation files:

  1. neural_manifold.mp4: High-quality video format
    • Higher quality
    • Smaller file size
    • Requires video player support
  2. neural_manifold.gif: Animated GIF format
    • More widely compatible
    • Larger file size
    • Can be viewed in any web browser

Customization

Key parameters that can be modified:

  • max_rates: Adjust neuron firing rates
  • tau_rc: Change membrane time constant
  • window: Modify the spike raster window size
  • freq: Adjust trajectory frequency
  • amplitude: Change trajectory size
  • FPS and bitrate for animation export

About

Visualisation of neural manifolds

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages