From d1eb6d4fed2a6a8e5d01c457f6ea529e7ef29208 Mon Sep 17 00:00:00 2001 From: vinistation <60822570+vinistation@users.noreply.github.com> Date: Fri, 28 Apr 2023 14:48:16 -0500 Subject: [PATCH 1/5] Update BasePyTorchRegressor.py Denormalization of prediction added to te PytorchMLP Model --- freqtrade/freqai/base_models/BasePyTorchRegressor.py | 1 + 1 file changed, 1 insertion(+) diff --git a/freqtrade/freqai/base_models/BasePyTorchRegressor.py b/freqtrade/freqai/base_models/BasePyTorchRegressor.py index ea6fabe49..bc47731b7 100644 --- a/freqtrade/freqai/base_models/BasePyTorchRegressor.py +++ b/freqtrade/freqai/base_models/BasePyTorchRegressor.py @@ -47,4 +47,5 @@ class BasePyTorchRegressor(BasePyTorchModel): y = self.model.model(x) y = y.cpu() pred_df = DataFrame(y.detach().numpy(), columns=[dk.label_list[0]]) + pred_df = dk.denormalize_labels_from_metadata(pred_df) return (pred_df, dk.do_predict) From a66e8768c96560fd0b7ca52f82af6ee20ea19174 Mon Sep 17 00:00:00 2001 From: vinistation <60822570+vinistation@users.noreply.github.com> Date: Fri, 28 Apr 2023 15:21:56 -0500 Subject: [PATCH 2/5] Update docker-compose.yml Enable GPU Image and GPU Resources --- docker-compose.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 445fbaea0..b8f48577a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -26,3 +26,12 @@ services: --db-url sqlite:////freqtrade/user_data/tradesv3.sqlite --config /freqtrade/user_data/config.json --strategy SampleStrategy + # Enable GPU Image and GPU Resources + #image: freqtradeorg/freqtrade:develop_freqaitorch + #deploy: + # resources: + # reservations: + # devices: + # - driver: nvidia + # count: 1 + # capabilities: [gpu] From 0d4010a0beafde62dd78603f85185c70cff7584e Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 19 May 2023 07:25:02 +0200 Subject: [PATCH 3/5] Add sample docker-compose file for freqAI, comment about that --- docker-compose.yml | 21 +++++++++--------- docker/docker-compose-freqai.yml | 37 ++++++++++++++++++++++++++++++++ docs/freqai-configuration.md | 4 +++- 3 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 docker/docker-compose-freqai.yml diff --git a/docker-compose.yml b/docker-compose.yml index b8f48577a..10a55e0dd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,15 @@ services: # image: freqtradeorg/freqtrade:develop # Use plotting image # image: freqtradeorg/freqtrade:develop_plot + # # Enable GPU Image and GPU Resources (only relevant for freqAI) + # # Make sure to uncomment the whole deploy section + # deploy: + # resources: + # reservations: + # devices: + # - driver: nvidia + # count: 1 + # capabilities: [gpu] # Build step - only needed when additional dependencies are needed # build: # context: . @@ -16,7 +25,7 @@ services: - "./user_data:/freqtrade/user_data" # Expose api on port 8080 (localhost only) # Please read the https://www.freqtrade.io/en/stable/rest-api/ documentation - # before enabling this. + # for more information. ports: - "127.0.0.1:8080:8080" # Default command used when running `docker compose up` @@ -26,12 +35,4 @@ services: --db-url sqlite:////freqtrade/user_data/tradesv3.sqlite --config /freqtrade/user_data/config.json --strategy SampleStrategy - # Enable GPU Image and GPU Resources - #image: freqtradeorg/freqtrade:develop_freqaitorch - #deploy: - # resources: - # reservations: - # devices: - # - driver: nvidia - # count: 1 - # capabilities: [gpu] + diff --git a/docker/docker-compose-freqai.yml b/docker/docker-compose-freqai.yml new file mode 100644 index 000000000..e8b3b89a1 --- /dev/null +++ b/docker/docker-compose-freqai.yml @@ -0,0 +1,37 @@ +--- +version: '3' +services: + freqtrade: + image: freqtradeorg/freqtrade:stable_freqaitorch + # # Enable GPU Image and GPU Resources + # # Make sure to uncomment the whole deploy section + # deploy: + # resources: + # reservations: + # devices: + # - driver: nvidia + # count: 1 + # capabilities: [gpu] + + # Build step - only needed when additional dependencies are needed + # build: + # context: . + # dockerfile: "./docker/Dockerfile.custom" + restart: unless-stopped + container_name: freqtrade + volumes: + - "./user_data:/freqtrade/user_data" + # Expose api on port 8080 (localhost only) + # Please read the https://www.freqtrade.io/en/stable/rest-api/ documentation + # for more information. + ports: + - "127.0.0.1:8080:8080" + # Default command used when running `docker compose up` + command: > + trade + --logfile /freqtrade/user_data/logs/freqtrade.log + --db-url sqlite:////freqtrade/user_data/tradesv3.sqlite + --config /freqtrade/user_data/config.json + --freqai-model XGBoostClassifier + --strategy SampleStrategy + diff --git a/docs/freqai-configuration.md b/docs/freqai-configuration.md index e7aca20be..7f5783a6e 100644 --- a/docs/freqai-configuration.md +++ b/docs/freqai-configuration.md @@ -248,9 +248,11 @@ The easiest way to quickly run a pytorch model is with the following command (fo freqtrade trade --config config_examples/config_freqai.example.json --strategy FreqaiExampleStrategy --freqaimodel PyTorchMLPRegressor --strategy-path freqtrade/templates ``` -!!! note "Installation/docker" +!!! Note "Installation/docker" The PyTorch module requires large packages such as `torch`, which should be explicitly requested during `./setup.sh -i` by answering "y" to the question "Do you also want dependencies for freqai-rl or PyTorch (~700mb additional space required) [y/N]?". Users who prefer docker should ensure they use the docker image appended with `_freqaitorch`. + We do provide an explicit docker-compose file for this in `docker/docker-compose-freqai.yml` - which can be used via `docker compose -f docker/docker-compose-freqai.yml run ...` - or can be copied to replace the original docker file. + This docker-compose file also contains a (disabled) section to enable GPU resources within docker containers. This obviously assumes the system has GPU resources available. ### Structure From a2cbe5df0419ca7bc5593f8aead3146c4c44bcfb Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 19 May 2023 07:26:11 +0200 Subject: [PATCH 4/5] Remove trailing spaces --- docker-compose.yml | 1 - docker/docker-compose-freqai.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 10a55e0dd..3b6f45bfc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,4 +35,3 @@ services: --db-url sqlite:////freqtrade/user_data/tradesv3.sqlite --config /freqtrade/user_data/config.json --strategy SampleStrategy - diff --git a/docker/docker-compose-freqai.yml b/docker/docker-compose-freqai.yml index e8b3b89a1..6edf41238 100644 --- a/docker/docker-compose-freqai.yml +++ b/docker/docker-compose-freqai.yml @@ -34,4 +34,3 @@ services: --config /freqtrade/user_data/config.json --freqai-model XGBoostClassifier --strategy SampleStrategy - From c4c0371ed3c4fd466d89e01ef05ee8b842757d1c Mon Sep 17 00:00:00 2001 From: robcaulk Date: Fri, 19 May 2023 14:48:17 +0000 Subject: [PATCH 5/5] add docker comment to docker usage freqai doc section --- docs/freqai.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/freqai.md b/docs/freqai.md index 02b723a20..3c4f47212 100644 --- a/docs/freqai.md +++ b/docs/freqai.md @@ -78,6 +78,9 @@ pip install -r requirements-freqai.txt If you are using docker, a dedicated tag with FreqAI dependencies is available as `:freqai`. As such - you can replace the image line in your docker compose file with `image: freqtradeorg/freqtrade:develop_freqai`. This image contains the regular FreqAI dependencies. Similar to native installs, Catboost will not be available on ARM based devices. +!!! note "docker-compose-freqai.yml" + We do provide an explicit docker-compose file for this in `docker/docker-compose-freqai.yml` - which can be used via `docker compose -f docker/docker-compose-freqai.yml run ...` - or can be copied to replace the original docker file. This docker-compose file also contains a (disabled) section to enable GPU resources within docker containers. This obviously assumes the system has GPU resources available. + ### FreqAI position in open-source machine learning landscape Forecasting chaotic time-series based systems, such as equity/cryptocurrency markets, requires a broad set of tools geared toward testing a wide range of hypotheses. Fortunately, a recent maturation of robust machine learning libraries (e.g. `scikit-learn`) has opened up a wide range of research possibilities. Scientists from a diverse range of fields can now easily prototype their studies on an abundance of established machine learning algorithms. Similarly, these user-friendly libraries enable "citzen scientists" to use their basic Python skills for data exploration. However, leveraging these machine learning libraries on historical and live chaotic data sources can be logistically difficult and expensive. Additionally, robust data collection, storage, and handling presents a disparate challenge. [`FreqAI`](#freqai) aims to provide a generalized and extensible open-sourced framework geared toward live deployments of adaptive modeling for market forecasting. The `FreqAI` framework is effectively a sandbox for the rich world of open-source machine learning libraries. Inside the `FreqAI` sandbox, users find they can combine a wide variety of third-party libraries to test creative hypotheses on a free live 24/7 chaotic data source - cryptocurrency exchange data.