This repository is dedicated to training and evaluating an XGBoost classifier on the Bitcoin technical indicators dataset. It aims to predict trading signals (like 'long', 'short', or 'neutral') based on the values of various indicators.
The Signal column, which serves as the target for this model, is generated from the Technical Analysis Repository. Ensure you've processed your data there to obtain the Signal labels before using this model.
- Data Cleaning: Removes rows with NaN values from the dataset.
- Data Preprocessing: Uses label encoding for the target column (Signal) and prepares the training and test data.
- XGBoost Classifier: An XGBoost model is trained on the dataset.
- Feature Importance: Evaluates and visualizes the importance of each feature used in the model.
- Model Evaluation: Evaluates the model's performance using metrics such as accuracy, ROC-AUC score, and more. It also provides a classification report and a confusion matrix.
Make sure you have the following Python packages installed:
numpy
matplotlib
xgboost
sklearn
You can install them using pip
:
pip install numpy matplotlib xgboost scikit-learn
- Clone this repository.
- Navigate to the repository's root directory in your terminal.
- Run the code using the following command:
python xgb.py
The code will generate:
- A bar chart showcasing the feature importances.
- A printed confusion matrix, classification report, accuracy score, and ROC-AUC score.
- A ROC curve plot.
- Technical Analysis Repository: This repository fetches 120 days of hourly Bitcoin price data, calculates technical indicators, and analyzes the relations between these indicators.
- XGBoost Model Optimization: Optimizing the hyperparameters of an XGBoost classifier using the hyperopt library.