This project predicts Tesla’s daily stock price movement (up or down) using historical OHLC data and machine learning models.
It demonstrates skills in data preprocessing, feature engineering, classification, model evaluation, and financial data analysis.
Core Concepts:
- Feature Engineering (derived price metrics, volatility indicators)
- Classification Modeling (Logistic Regression, SVM, XGBoost)
- Model Evaluation (Accuracy, Cross-Validation, Confusion Matrix)
- Predictive Analytics for Financial Time Series
Modules/Libraries:
pandas, numpy, matplotlib, seaborn, scikit-learn, xgboost
Tesla-Stock-Prediction/
│
├── data/
│ └── tesla.csv # Historical Tesla stock data
│
├── tesla_stock_prediction.py # Main ML pipeline code
│
├── README.md # Project documentation
│
└── results/
└── plots/ # Saved performance and trend plots
--
- Loaded and cleaned Tesla stock data
- Created new features:
open-close→ measures daily price differencelow-high→ measures volatilityis_quarter_end→ identifies end-of-quarter trading days
- Split data into training and validation sets using
train_test_split
Implemented and trained multiple classification models:
- Logistic Regression
- Support Vector Classifier (SVC)
- XGBoost Classifier
Evaluated performance using:
- Accuracy Score
- Confusion Matrix
- Cross-Validation (
cross_val_score)
Visualized model comparison using Matplotlib and Seaborn.
| Model | Accuracy | Key Insight |
|---|---|---|
| Logistic Regression | ~55–60% | Baseline model for comparison |
| Support Vector Classifier | ~60–65% | Captures non-linear boundaries |
| XGBoost Classifier | ~70%+ | Best performance through boosting |