Long-Short Term Memory (LSTM) for Cash Flow Prediction

This project uses LSTM networks to predict cash flow using synthetic and real-world coffee shop datasets.

Educational Content
Learn about AI, ML, RNN, and LSTM networks

Understand the fundamentals of artificial intelligence, machine learning, recurrent neural networks, and long-short term memory networks.

Synthetic Dataset
Controlled patterns for LSTM testing

Explore a 3-year synthetic cash flow dataset with controlled patterns like linear trends and seasonal spikes for testing LSTM under controlled conditions.

Coffee Shop Dataset
Real-world financial data analysis

Examine a real-world dataset from Kaggle with daily revenue data for a coffee shop to test LSTM on actual financial data.

Project Overview

This educational website presents a comprehensive exploration of using Long-Short Term Memory (LSTM) networks for cash flow prediction. The project demonstrates how advanced neural network architectures can be applied to financial forecasting tasks.

Through detailed examples using both synthetic and real-world datasets, we showcase the entire process from data generation and preprocessing to model training and evaluation. The project is designed for audiences with a basic understanding of programming and data science.

Navigate through the different sections to learn about the theoretical foundations of AI and machine learning, and see practical implementations of LSTM networks for financial forecasting.

Source Code

This project includes complete Python source code for both the synthetic dataset and coffee shop examples. The implementation files are:

  • train_lstm_keras.py: Training script for the synthetic dataset with custom SelfAttention layer, cyclic learning rate, and K-fold cross-validation
  • test_lstm_keras.py: Testing script for the synthetic dataset model
  • train_lstm_keras_coffee.py: Training script for the coffee shop dataset with specialized features
  • test_lstm_keras_coffee.py: Testing script for the coffee shop model

These source files contain the complete implementation details that are explained throughout this website, including preprocessing steps, model architecture, training procedures, and evaluation methods.

Requirements

To run these scripts, you'll need the following Python packages:

tensorflow>=2.8.0
numpy>=1.19.5
pandas>=1.3.0
scikit-learn>=1.0.0
matplotlib>=3.4.0