refactor set_weights_higher_recent

This commit is contained in:
longyu 2022-07-15 23:02:09 +02:00
parent 00461850f5
commit 7260a71ecb

View File

@ -675,12 +675,10 @@ class FreqaiDataKitchen:
Set weights so that recent data is more heavily weighted during
training than older data.
"""
wfactor = self.config["freqai"]["feature_parameters"]["weight_factor"]
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)
)
weights[1:] = np.exp(
- np.arange(1, len(weights)) / (wfactor * num_weights))[::-1]
return weights
def append_predictions(self, predictions, do_predict, len_dataframe):