Feat/freqai (#7105)

Vectorize weight setting, log training dates

Co-authored-by: robcaulk <rob.caulk@gmail.com>
This commit is contained in:
lolong
2022-07-19 17:49:18 +02:00
committed by GitHub
parent 714d9534b6
commit 9c051958a6
2 changed files with 8 additions and 7 deletions

View File

@@ -680,12 +680,9 @@ class FreqaiDataKitchen:
Set weights so that recent data is more heavily weighted during
training than older data.
"""
weights = np.zeros(num_weights)
for i in range(1, len(weights)):
weights[len(weights) - i] = np.exp(
-i / (self.config["freqai"]["feature_parameters"]["weight_factor"] * num_weights)
)
wfactor = self.config["freqai"]["feature_parameters"]["weight_factor"]
weights = np.exp(
- np.arange(num_weights) / (wfactor * num_weights))[::-1]
return weights
def append_predictions(self, predictions, do_predict, len_dataframe):