A comprehensive Data Mining project that explores time series forecasting using both classical machine learning and deep learning techniques. The project focuses on predicting future stock prices from the NASDAQ-100 dataset through feature engineering, model comparison, and multi-step forecasting.
Note:
This project was originally developed in Jupyter Notebook. For easier version control and sharing on GitHub, the notebook has been exported as a Python (.py) file while preserving the original implementation.
| Item | Description |
|---|---|
| Course | Data Mining |
| University | Shahid Beheshti University |
| Semester | Spring 2026 |
| Author | Mahan Baneshi |
The objective of this project is to investigate different approaches for financial time series forecasting and compare their predictive performance.
The project follows a complete data mining pipeline including:
- Data preprocessing
- Feature engineering
- Classical machine learning models
- Deep learning with LSTM
- Advanced technical indicators
- Multi-step recursive forecasting
- Performance evaluation
The project uses historical NASDAQ-100 market data containing stock price information such as:
- Open
- High
- Low
- Close
- Volume
The dataset is cleaned and organized chronologically before model training.
- Load historical data
- Handle missing values
- Remove duplicate records
- Convert dates to datetime format
- Sort observations chronologically
Several features are generated from the raw stock prices, including:
- Daily Return
- Price Range
- Moving Average (5 Days)
- Moving Average (10 Days)
- Rolling Volatility
To improve forecasting accuracy, several technical indicators are incorporated:
- Relative Strength Index (RSI)
- Moving Average Convergence Divergence (MACD)
- Signal Line
- Average True Range (ATR)
- Bollinger Bands
These indicators provide additional information about momentum, volatility, and market trends.
The dataset is divided while preserving chronological order:
- 70% Training Set
- 15% Validation Set
- 15% Test Set
Sliding windows are then created for sequence prediction.
The following regression models are implemented and compared:
- Linear Regression
- Random Forest Regressor
- XGBoost Regressor
- Support Vector Regression (SVR)
An LSTM (Long Short-Term Memory) neural network is implemented for sequential forecasting.
The model includes:
- LSTM Layer
- Dropout Layer
- Dense Output Layer
- Early Stopping
- Model Checkpointing
The performance of each model is evaluated using:
- RMSE (Root Mean Squared Error)
- MAE (Mean Absolute Error)
- MAPE (Mean Absolute Percentage Error)
- R² Score
Training time is also recorded for comparison.
The project implements recursive forecasting to predict multiple future time steps.
Forecasts are generated for a 10-day prediction horizon, allowing comparison between short-term and long-term prediction accuracy.
- Python
- Jupyter Notebook
- NumPy
- Pandas
- Matplotlib
- Scikit-learn
- TensorFlow / Keras
- XGBoost
.
├── NASDAQ100_data.csv
├── project.py # Converted from Jupyter Notebook
├── best_lstm_model.keras
├── best_lstm_advanced_model.keras
├── README.md
└── requirements.txt
| Category | Models |
|---|---|
| Machine Learning | Linear Regression, Random Forest, XGBoost, SVR |
| Deep Learning | LSTM |
| Forecasting | Recursive Multi-Step Prediction |
- Complete time series preprocessing pipeline
- Classical and deep learning model comparison
- Technical indicator engineering
- Sliding window sequence generation
- Multi-step recursive forecasting
- Performance comparison using multiple evaluation metrics
- Visualization of training and forecasting results
Clone the repository:
git clone <repository-url>Install the required packages (numpy - pandas - matplotlib - sickitlearn , ...0
Run the project in Jupyter Notebook (also Annaconda or vs code)
The project compares all implemented models based on forecasting accuracy and computational efficiency.
Performance is evaluated using multiple regression metrics, and the best-performing models are further analyzed through recursive multi-step forecasting.
This project was developed as part of the Data Mining course at Shahid Beheshti University during the Spring 2026 semester.
Mahan Baneshi
This repository is intended solely for educational purposes as part of the Data Mining course at Shahid Beheshti University.