isolate and standardize location of tensorboard files, add doc, ensure backtesting functionality

This commit is contained in:
robcaulk 2022-10-09 21:11:37 +02:00
parent ec7af83c87
commit a4aa1b972c
6 changed files with 23 additions and 7 deletions

View File

@ -142,6 +142,20 @@ dataframe['outlier'] = np.where(dataframe['DI_values'] > self.di_max.value/10, 1
This specific hyperopt would help you understand the appropriate `DI_values` for your particular parameter space. This specific hyperopt would help you understand the appropriate `DI_values` for your particular parameter space.
## Using Tensorboard
Catboost models benefit from tracking training metrics via Tensorboard. You can take advantage of the FreqAI integration to track training and evaluation performance across all coins and across all retrainings. Tensorboard is activated via the following command:
```bash
cd freqtrade
tensorboard --logdir user_data/models/unique-id
```
where `unique-id` is the `identifier` set in the `freqai` configuration file. This command must be run in a separate shell if the user wishes to view the output in their browser at 127.0.0.1:6060 (6060 is the default port used by Tensorboard).
![tensorboard](assets/tensorboard.jpg)
## Setting up a follower ## Setting up a follower
You can indicate to the bot that it should not train models, but instead should look for models trained by a leader with a specific `identifier` by defining: You can indicate to the bot that it should not train models, but instead should look for models trained by a leader with a specific `identifier` by defining:

View File

@ -120,6 +120,8 @@ class FreqaiDataKitchen:
/ f"sub-train-{pair.split('/')[0]}_{trained_timestamp}" / f"sub-train-{pair.split('/')[0]}_{trained_timestamp}"
) )
Path(self.data_path / 'tensorboard').mkdir(parents=True, exist_ok=True)
return return
def make_train_test_datasets( def make_train_test_datasets(

View File

@ -196,7 +196,6 @@ class IFreqaiModel(ABC):
(_, trained_timestamp, _) = self.dd.get_pair_dict_info(pair) (_, trained_timestamp, _) = self.dd.get_pair_dict_info(pair)
dk = FreqaiDataKitchen(self.config, self.live, pair) dk = FreqaiDataKitchen(self.config, self.live, pair)
dk.set_paths(pair, trained_timestamp)
( (
retrain, retrain,
new_trained_timerange, new_trained_timerange,
@ -267,9 +266,7 @@ class IFreqaiModel(ABC):
) )
trained_timestamp_int = int(trained_timestamp.stopts) trained_timestamp_int = int(trained_timestamp.stopts)
dk.data_path = Path( dk.set_paths(pair, trained_timestamp_int)
dk.full_path / f"sub-train-{pair.split('/')[0]}_{trained_timestamp_int}"
)
dk.set_new_model_names(pair, trained_timestamp) dk.set_new_model_names(pair, trained_timestamp)

View File

@ -1,4 +1,5 @@
import logging import logging
from pathlib import Path
from typing import Any, Dict from typing import Any, Dict
from catboost import CatBoostClassifier, Pool from catboost import CatBoostClassifier, Pool
@ -34,7 +35,7 @@ class CatboostClassifier(BaseClassifierModel):
cbr = CatBoostClassifier( cbr = CatBoostClassifier(
allow_writing_files=True, allow_writing_files=True,
loss_function='MultiClass', loss_function='MultiClass',
train_dir=dk.data_path, train_dir=Path(dk.data_path / 'tensorboard'),
**self.model_training_parameters, **self.model_training_parameters,
) )

View File

@ -1,4 +1,5 @@
import logging import logging
from pathlib import Path
from typing import Any, Dict from typing import Any, Dict
from catboost import CatBoostRegressor, Pool from catboost import CatBoostRegressor, Pool
@ -42,7 +43,7 @@ class CatboostRegressor(BaseRegressionModel):
model = CatBoostRegressor( model = CatBoostRegressor(
allow_writing_files=True, allow_writing_files=True,
train_dir=dk.data_path, train_dir=Path(dk.data_path / 'tensorboard'),
**self.model_training_parameters, **self.model_training_parameters,
) )

View File

@ -1,4 +1,5 @@
import logging import logging
from pathlib import Path
from typing import Any, Dict from typing import Any, Dict
from catboost import CatBoostRegressor, Pool from catboost import CatBoostRegressor, Pool
@ -27,7 +28,7 @@ class CatboostRegressorMultiTarget(BaseRegressionModel):
cbr = CatBoostRegressor( cbr = CatBoostRegressor(
allow_writing_files=True, allow_writing_files=True,
train_dir=dk.data_path, train_dir=Path(dk.data_path / 'tensorboard'),
**self.model_training_parameters, **self.model_training_parameters,
) )