Merge pull request #1 from lolongcovas/refactor_set_weights_higher_recent
Refactor set weights higher recent
This commit is contained in:
commit
c10c962f1b
@ -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):
|
||||||
|
@ -39,7 +39,10 @@ class BaseRegressionModel(IFreqaiModel):
|
|||||||
:model: Trained model which can be used to inference (self.predict)
|
:model: Trained model which can be used to inference (self.predict)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger.info("--------------------Starting training " f"{pair} --------------------")
|
start_date = unfiltered_dataframe["date"].iloc[0]
|
||||||
|
end_date = unfiltered_dataframe["date"].iloc[-1]
|
||||||
|
logger.info("-------------------- Starting training " f"{pair} --------------------")
|
||||||
|
logger.info("-------------------- Using data " f"from {start_date} to {end_date}--------------------")
|
||||||
|
|
||||||
# filter the features requested by user in the configuration file and elegantly handle NaNs
|
# filter the features requested by user in the configuration file and elegantly handle NaNs
|
||||||
features_filtered, labels_filtered = dk.filter_features(
|
features_filtered, labels_filtered = dk.filter_features(
|
||||||
|
Loading…
Reference in New Issue
Block a user