allow users to pass 0 test data

This commit is contained in:
robcaulk 2022-12-05 20:55:05 +01:00
parent 5826fae8ee
commit 72b1d1c9ae
3 changed files with 8 additions and 2 deletions

View File

@ -89,6 +89,6 @@ Mandatory parameters are marked as **Required** and have to be set in one of the
| Parameter | Description | | Parameter | Description |
|------------|-------------| |------------|-------------|
| | **Extraneous parameters** | | **Extraneous parameters**
| `freqai.keras` | If the selected model makes use of Keras (typical for Tensorflow-based prediction models), this flag needs to be activated so that the model save/loading follows Keras standards. <br> **Datatype:** Boolean. <br> Default: `False`. | `freqai.keras` | If the selected model makes use of Keras (typical for Tensorflow-based prediction models), this flag should be activated so that the model save/loading follows Keras standards. If the the provided `CNNPredictionModel` is used, then this is handled automatically. <br> **Datatype:** Boolean. <br> Default: `False`.
| `freqai.conv_width` | The width of a convolutional neural network input tensor. This replaces the need for shifting candles (`include_shifted_candles`) by feeding in historical data points as the second dimension of the tensor. Technically, this parameter can also be used for regressors, but it only adds computational overhead and does not change the model training/prediction. <br> **Datatype:** Integer. <br> Default: `2`. | `freqai.conv_width` | The width of a convolutional neural network input tensor. This replaces the need for shifting candles (`include_shifted_candles`) by feeding in historical data points as the second dimension of the tensor. Technically, this parameter can also be used for regressors, but it only adds computational overhead and does not change the model training/prediction. <br> **Datatype:** Integer. <br> Default: `2`.
| `freqai.reduce_df_footprint` | Recast all numeric columns to float32/int32, with the objective of reducing ram/disk usage and decreasing train/inference timing. This parameter is set in the main level of the Freqtrade configuration file (not inside FreqAI). <br> **Datatype:** Boolean. <br> Default: `False`. | `freqai.reduce_df_footprint` | Recast all numeric columns to float32/int32, with the objective of reducing ram/disk usage and decreasing train/inference timing. This parameter is set in the main level of the Freqtrade configuration file (not inside FreqAI). <br> **Datatype:** Boolean. <br> Default: `False`.

View File

@ -23,6 +23,7 @@ class BaseTensorFlowModel(IFreqaiModel):
if self.ft_params.get("DI_threshold", 0): if self.ft_params.get("DI_threshold", 0):
self.ft_params["DI_threshold"] = 0 self.ft_params["DI_threshold"] = 0
logger.warning("DI threshold is not configured for Keras models yet. Deactivating.") logger.warning("DI threshold is not configured for Keras models yet. Deactivating.")
self.dd.model_type = 'keras'
def train( def train(
self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs self, unfiltered_df: DataFrame, pair: str, dk: FreqaiDataKitchen, **kwargs

View File

@ -75,11 +75,16 @@ class CNNPredictionModel(BaseTensorFlowModel):
metrics=[tf.metrics.MeanAbsoluteError()], metrics=[tf.metrics.MeanAbsoluteError()],
) )
if self.freqai_info.get('data_split_parameters', {}).get('test_size', 0.1) == 0:
val_data = None
else:
val_data = w1.val
model.fit( model.fit(
w1.train, w1.train,
epochs=MAX_EPOCHS, epochs=MAX_EPOCHS,
shuffle=False, shuffle=False,
validation_data=w1.val, validation_data=val_data,
callbacks=[early_stopping], callbacks=[early_stopping],
verbose=1, verbose=1,
) )