This project aims to predict stock prices using machine learning algorithms. Three different algorithms were used: Logistic Regression, SVC, and XGBClassifier. The accuracy of each algorithm was evaluated, and the best-performing algorithm was selected for use in the final model.
The data for this project was obtained from the Yahoo Finance website. The data includes the daily opening, high, low, and closing prices of a stock for a period of five years.
The data was preprocessed by normalizing the prices and converting the categorical features (e.g., date) into numerical features.
Several features were engineered from the raw data, including moving averages, Bollinger Bands, and relative strength index (RSI).
Three different machine learning algorithms were used to predict stock prices: Logistic Regression, SVC, and XGBClassifier.
The accuracy of each algorithm was evaluated using the holdout method. The accuracy of the Logistic Regression model was 0.5702, the accuracy of the SVC model was 0.5330, and the accuracy of the XGBClassifier model was 0.5165.
The Logistic Regression model was the most accurate of the three algorithms tested. The model was able to achieve an accuracy of 0.5702, which is significantly better than the accuracy of the other two models.
The next steps for this project will be to improve the accuracy of the model by using a larger dataset and more sophisticated machine learning algorithms.
The following libraries were used in this project:
- pandas
- numpy
- sklearn
- matplotlib
To run this project, you will need to install the following libraries:
- pandas
- numpy
- sklearn
- matplotlib
Once you have installed the libraries, you can run the project by following these steps:
- Clone the repository to your computer.
- Open the project in a Python IDE.
- Run the
main.py
script.
This project is licensed under the MIT License.