A machine learning pipeline for forecasting Tesla's closing stock prices using:
- Linear Regression
- Support Vector Machine (SVM)
- LSTM (optional extension)
This project includes:
β
Data preprocessing
β
Sliding window supervised dataset creation
β
Model training & evaluation
β
Recursive future prediction
β
Pytest unit tests
β
GitHub Actions continuous integration
Mean Absolute Error (MAE)
Root Mean Squared Error (RMSE)
Visual Actual vs Predicted plots
Model comparison bar charts
Hyperparameter tuning with GridSearchCV and KerasTuner
## π Project structure
my-tesla-ml-project/ βββ .github/workflows/python-tests.yml # GitHub Actions CI workflow βββ tests/test_ml_pipeline.py # Pytest unit tests βββ requirements.txt # Project dependencies βββ src/project_tesla.py # code βββ README.md # Project documentation
---
## βοΈ Setup
### Clone the repository
```bash
git clone https://github.com/your-username/your-repo-name.git
cd your-repo-name
pip install -r requirements.txtYou can run your ML code from src/ (or main notebook/script).
Example:
python src/your_ml_code.pyTo run tests locally:
pytest -v tests/GitHub Actions will run tests automatically on push / PR.
- Plots: Actual vs predicted prices
- Metrics: MAE, RMSE reported for test data
- Future forecasts: Recursive predictions for future closing prices
- Ensure you have access to the Tesla stock CSV dataset (e.g.
TSLA.csv). - The pipeline assumes time series order (no shuffle in train/test split).
- Add more features (Open, High, Low, Volume)
- Add stacked models / ensembles
- Add hyperparameter tuning for LSTM