---
# System prepended metadata

title: Data Science Assignment

---

# Data Science Assignment

## Structure of project
```
├──README.md
├──pyproject.toml
├──poetry.lock
├──params.yaml
├──data
│   ├──raw
│   │   ├──assignment_features.csv
│   │   └──assignment_labels_ohlcv.csv
│   ├──processed
│   │   ├──dataset_preprocessed.csv
│   │   ├──X_test.csv
│   │   ├──X_train.csv
│   │   ├──y_train.csv
│   │   └──y_test.csv
│   └──result
│       ├──y_test_predict.csv
│       └──y_train_predict.csv
├──notebooks
│   ├──run.ipynb
│   └──investigation.ipynb
├──reports
│   └──metrics.json
└──src
    ├──feature
    │   ├──data_preprocessing.py
    │   └──train_test_split_dataset.py
    ├──models
    │   ├──first_model.py
    │   ├──second_model.py
    │   └──predict_model.py
    └──utils
        └──logger.py

```

## How to test the code
To see how the models work, you need to do the following steps: 
* Install all dependencies 
```
poetry install
```

>P.S.  If you don't have poetry you can install it by this command:

>```
>curl -sSL https://install.python-poetry.org | python3 -
>```

* Jump to `run.ipynb`
* Run all cells

## Data preparation
Before us is the problem of binary classification. Firstly, I looked at whether there is an imbalance in the classes and the quality of the data. In addition, I converted a date to a timestamp and removed unnecessary columns.

## Models
Since I was doing the task in a small amount of time, I decided to use strong methods right away. Therefore, my choice fell on `CatBoostClassifier`. But since in this issue we are solving, accuracy is more important than recall (since it is more terrible to invest money in an incorrect forecast and lose it than not to make money on all the possibilities), I also wanted to control the probabilities of the outcomes predicted by the model. For this, I decided to use the `CalibratedClassifierCV`, which converts the results of the `CatBoostClassifier` into a probability. So, in this way, I can already control with what probability the price will go up or down.

## Models performance
To select the best hyperparameters for the model, I used the library: `optuna`.
Unfortunately, at the moment I have not been able to conduct enough experiments to achieve good results with the model, but due to the good structure of the code, it will take a little time to improve the performance of the models through additional experiments.
