π Stock Price Forecasting - DataSynthis ML Job Task
This repository contains implementations of time-series forecasting for stock prices using both traditional statistical models (ARIMA, Prophet) and deep learning (LSTM).
The project demonstrates model comparison, rolling-window evaluation, and deployment to Hugging Face Hub.
Project Overview
- Dataset: Daily stock price dataset (closing prices).
- Models Implemented:
- ARIMA (AutoRegressive Integrated Moving Average)
- Prophet (Additive Time Series Forecasting by Meta)
- LSTM (Long Short-Term Memory Neural Network)
- Evaluation:
- Rolling-window forecasts
- Metrics: RMSE, MAPE
- Deployment:
- Models and results shared on Hugging Face Hub.
Repository Contents
lstm_model.h5β Trained LSTM modelscaler.pklβ Scaler used for preprocessingperformance_summary.csvβ Comparison of ARIMA, Prophet, and LSTM performancestock_forecasting_notebook.ipynbβ Full notebook with preprocessing, training, evaluation, and plotsupload_to_hf.pyβ Script for uploading to Hugging Face Hub
Quick start
- Create and activate a python environment (recommended: conda or venv)
python -m venv venv source venv/bin/activate # Linux/macOS venv\Scripts\activate # Windows pip install -r requirements.txt - Start Jupyter and open the notebook:
jupyter notebook stock_forecasting_notebook.ipynb - The notebook contains cells to download real stock data via
yfinance(if you have internet) or use the includedsample_stock.csvfor an offline demo.
Hugging Face deployment (notes)
- Use
upload_to_hf.pyto push saved model files to the HF repoDataSynthis_ML_JobTaskafter creating it on the Hugging Face website (or the script will create the repo for you if you provide a valid token). - Create a HF token at https://huggingface.co/settings/tokens and set environment variable
HF_TOKENor pass--tokento the script.
Results
The performance of the three models on stock price forecasting is summarized below:
| Model | RMSE | MAPE (%) |
|---|---|---|
| ARIMA | 3.3748 | 1.8973 |
| Prophet | 4.7650 | 3.1859 |
| LSTM | 2.0890 | 1.2516 |
Key Insights
- LSTM achieved the lowest RMSE and MAPE, showing the best accuracy.
- ARIMA performed reasonably well, but less effective with non-linear trends.
- Prophet captured trends and seasonality but had higher errors.
- Overall, LSTM is the most reliable model for this task.
- Downloads last month
- -
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support