# CDNN
# Covariance Density Neural Networks (CDNN)

This repository contains the implementation for **Covariance Density Neural Networks (CDNN)**. All experiments are fully runnable on [Google Colab](https://colab.research.google.com).

## Table of Contents

- [Overview](#overview)
- [Repository Structure](#repository-structure)
- [Experiments](#experiments)
  - [Brain Computer Interface (BCI) Experiments](#brain-computer-interface-bci-experiments)
  - [Financial Forecasting](#financial-forecasting)
  - [Von Neumann Entropy for Covariance Matrices and LDA Experiment](#VNE-LDA)
  - [K-L Divergence De-noising Routine](#k-l-divergence-de-noising-routine)
- [Usage](#usage)
- [FilterbankVNN](#filterbankvnn)

## Overview

Covariance Density Neural Networks (CDNN) is a novel neural network architecture that uses a Covariance Density Matrix operator to leverage covariance information at multiple scales to enhance model performance. This repository showcases the application of CDNN across multiple domains including brain-computer interfaces and financial forecasting.

## Repository Structure

- **`BCI_CDNN.ipynb/`**  
  Contains all scripts for Brain Computer Interface experiments. The BCI-2A data is automatically downloaded via scripts utilizing [Braindecode](https://github.com/braindecode/braindecode) and [MOABB](https://github.com/NeuroTechX/moabb).

- **`FinForecastCDNN.ipynb`**  
  Jupyter Notebook with experiments on financial forecasting. All relevant financial data files are included in the repository.

- **`KL_ROUTINE_CDNN.ipynb`**  
  Notebook implementing the K-L Divergence De-noising routine.

- **VNE_LDA**  
  Implementation of Multi-Scale Von Neumann Entropy for Covariance Matrices and LDA experiment showing advantage over naive approaches. 

- **FilterbankVNN**  
  Represents the multi-scale CDNN network architecture employed in all experiments.

## Experiments

### Brain Computer Interface (BCI) Experiments

The BCI experiments are fully contained in the `CDNN_ICML_BCI_EXPERIMENTS.ipynb` file. They include:
- **BCI-2A Data:** Downloaded automatically via Braindecode and MOABB.
- **PhysioNet Data:** Accessible from [PhysioNet Database](https://physionet.org/about/database/).
- 
### Financial Forecasting

The `Financial_Forecasting_CDNN.ipynb` notebook contains experiments demonstrating the application of CDNN to financial forecasting. All necessary financial data is provided in the repository.

### K-L Divergence De-noising Routine

The `KL_ROUTINE_CDNN.ipynb` notebook implements a K-L Divergence based de-noising routine.


## Usage

All experiments are designed to run on Google Colab. To get started:

1. Open the desired notebook in [Google Colab](https://colab.research.google.com).
2. Follow the instructions provided in each notebook to install dependencies and download the required datasets.
3. Execute the notebook cells to run the experiments.

## FilterbankVNN

`FilterbankVNN` is the implementation of the multi-scale CDNN network architecture used across all experiments. It demonstrates the core idea behind CDNN by incorporating multi-scale covariance information in neural network models.


---

For further details, please refer to the documentation within the respective notebooks and scripts.
