fix: ensure that a user setting up their own pipeline wont have conflicts with DI_values

This commit is contained in:
robcaulk 2023-06-17 13:21:31 +02:00
parent 72101f059d
commit 11ff454b3b
3 changed files with 3 additions and 7 deletions

View File

@ -250,17 +250,13 @@ class BaseReinforcementLearningModel(IFreqaiModel):
dk.data_dictionary["prediction_features"] = self.drop_ohlc_from_df(filtered_dataframe, dk)
dk.data_dictionary["prediction_features"], outliers, _ = dk.feature_pipeline.transform(
dk.data_dictionary["prediction_features"], _, _ = dk.feature_pipeline.transform(
dk.data_dictionary["prediction_features"], outlier_check=True)
pred_df = self.rl_model_predict(
dk.data_dictionary["prediction_features"], dk, self.model)
pred_df.fillna(0, inplace=True)
if self.freqai_info.get("DI_threshold", 0) > 0:
dk.DI_values = dk.feature_pipeline["di"].di_values
dk.do_predict = outliers.to_numpy()
return (pred_df, dk.do_predict)
def rl_model_predict(self, dataframe: DataFrame,

View File

@ -52,7 +52,7 @@ class BasePyTorchRegressor(BasePyTorchModel):
pred_df = DataFrame(y.detach().tolist(), columns=[dk.label_list[0]])
pred_df, _, _ = dk.label_pipeline.inverse_transform(pred_df)
if self.freqai_info.get("DI_threshold", 0) > 0:
if dk.feature_pipeline["di"]:
dk.DI_values = dk.feature_pipeline["di"].di_values
else:
dk.DI_values = np.zeros(len(outliers.index))

View File

@ -111,7 +111,7 @@ class BaseRegressionModel(IFreqaiModel):
pred_df = DataFrame(predictions, columns=dk.label_list)
pred_df, _, _ = dk.label_pipeline.inverse_transform(pred_df)
if self.freqai_info.get("DI_threshold", 0) > 0:
if dk.feature_pipeline["di"]:
dk.DI_values = dk.feature_pipeline["di"].di_values
else:
dk.DI_values = np.zeros(len(outliers.index))