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.
- Python 3.8+
- Required packages (see requirements.txt):
- numpy
- pandas
- matplotlib
- scikit-learn
-
Clone the repository:
git clone https://github.com/your_username/your_repo.git cd your_repo -
Install dependencies:
pip install -r requirements.txt
-
Prepare the data:
- Place your S&P 500 CSV file as
SP500.csvin the project directory.
- Place your S&P 500 CSV file as
- 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
- 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.
.
├── 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
See requirements.txt for the full list.
Contributions are welcome! Please open an issue or submit a pull request for improvements or bug fixes.
- Inspired by foundational SNN research and the seed paper on biologically plausible learning.
- See references in the project report for related work.