refactor set_weights_higher_recent
This commit is contained in:
parent
00461850f5
commit
7260a71ecb
@ -675,12 +675,10 @@ class FreqaiDataKitchen:
|
|||||||
Set weights so that recent data is more heavily weighted during
|
Set weights so that recent data is more heavily weighted during
|
||||||
training than older data.
|
training than older data.
|
||||||
"""
|
"""
|
||||||
|
wfactor = self.config["freqai"]["feature_parameters"]["weight_factor"]
|
||||||
weights = np.zeros(num_weights)
|
weights = np.zeros(num_weights)
|
||||||
for i in range(1, len(weights)):
|
weights[1:] = np.exp(
|
||||||
weights[len(weights) - i] = np.exp(
|
- np.arange(1, len(weights)) / (wfactor * num_weights))[::-1]
|
||||||
-i / (self.config["freqai"]["feature_parameters"]["weight_factor"] * num_weights)
|
|
||||||
)
|
|
||||||
return weights
|
return weights
|
||||||
|
|
||||||
def append_predictions(self, predictions, do_predict, len_dataframe):
|
def append_predictions(self, predictions, do_predict, len_dataframe):
|
||||||
|
Loading…
Reference in New Issue
Block a user