Skip to content

Repository files navigation

Learning Permutation Matrix Patterns in the NARMA Dataset with Spiking Neural Networks

Overview

This project explores the application of Spiking Neural Networks (SNNs) for classifying structured financial time series data. We use permutation matrices derived from S&P 500 index segments (NARMA dataset) as input, and evaluate the ability of a single-layer SNN to recognize temporal patterns using spike-based computation and fixed synaptic weights.
The codebase includes data preprocessing, spike train encoding, SNN simulation, and performance evaluation.

Table of Contents

Getting Started

Prerequisites

  • Python 3.8+
  • Required packages (see requirements.txt):
    • numpy
    • pandas
    • matplotlib
    • scikit-learn

Installation

  1. Clone the repository:

    git clone https://github.com/your_username/your_repo.git
    cd your_repo
  2. Install dependencies:

    pip install -r requirements.txt
  3. Prepare the data:

    • Place your S&P 500 CSV file as SP500.csv in the project directory.

Usage

  • Run the main classification pipeline:
    python classify.py
  • The script will:
    • Preprocess the data into permutation matrices
    • Encode inputs as spike trains
    • Simulate the SNN and output predictions
    • Save a confusion matrix plot and sample input visualizations

Results

  • The SNN achieved selective recognition of canonical trends, with an overall accuracy of ~38% on the NARMA dataset (522 samples).
  • Confusion matrices and analysis of error types (false positives, always-firing, etc.) are generated for further insight.

Project Structure

.
├── classify.py                # Main SNN classification script
├── DataPreprocessing.py         # Data preprocessing and matrix generation
├── neuron.py                  # Spiking neuron class
├── recep_field.py             # Receptive field transformation
├── spike_train.py             # Spike train encoding
├── weight_initialization.py   # Synaptic weight initialization
├── SP500.csv                  # S&P 500 data (user-provided)
└── README.md

Dependencies

See requirements.txt for the full list.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for improvements or bug fixes.

Acknowledgements

  • Inspired by foundational SNN research and the seed paper on biologically plausible learning.
  • See references in the project report for related work.

About

Exploring Spiking Neural networks

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages