add noise feature, improve docstrings
This commit is contained in:
parent
98c62dad91
commit
755041c134
@ -752,6 +752,17 @@ class FreqaiDataKitchen:
|
|||||||
self.data_dictionary[f'{set_}_features'] = features.iloc[no_prev_pts:]
|
self.data_dictionary[f'{set_}_features'] = features.iloc[no_prev_pts:]
|
||||||
self.data_dictionary[f'{set_}_labels'] = labels.iloc[no_prev_pts:]
|
self.data_dictionary[f'{set_}_labels'] = labels.iloc[no_prev_pts:]
|
||||||
|
|
||||||
|
def add_noise_to_training_features(self) -> None:
|
||||||
|
"""
|
||||||
|
Add noise to train features to reduce the risk of overfitting.
|
||||||
|
"""
|
||||||
|
mu = 0 # no shift
|
||||||
|
sigma = self.freqai_config["feature_parameters"]["noise_standard_deviation"]
|
||||||
|
compute_df = self.data_dictionary['train_features']
|
||||||
|
noise = np.random.normal(mu, sigma, [compute_df.shape[0], compute_df.shape[1]])
|
||||||
|
self.data_dictionary['train_features'] += noise
|
||||||
|
return
|
||||||
|
|
||||||
def find_features(self, dataframe: DataFrame) -> None:
|
def find_features(self, dataframe: DataFrame) -> None:
|
||||||
"""
|
"""
|
||||||
Find features in the strategy provided dataframe
|
Find features in the strategy provided dataframe
|
||||||
|
@ -385,10 +385,9 @@ class IFreqaiModel(ABC):
|
|||||||
|
|
||||||
def data_cleaning_train(self, dk: FreqaiDataKitchen) -> None:
|
def data_cleaning_train(self, dk: FreqaiDataKitchen) -> None:
|
||||||
"""
|
"""
|
||||||
Base data cleaning method for train
|
Base data cleaning method for train.
|
||||||
Any function inside this method should drop training data points from the filtered_dataframe
|
Functions here improve/modify the input data by identifying outliers,
|
||||||
based on user decided logic. See FreqaiDataKitchen::use_SVM_to_remove_outliers() for an
|
computing additional metrics, adding noise, reducing dimensionality etc.
|
||||||
example of how outlier data points are dropped from the dataframe used for training.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
ft_params = self.freqai_info["feature_parameters"]
|
ft_params = self.freqai_info["feature_parameters"]
|
||||||
@ -417,16 +416,13 @@ class IFreqaiModel(ABC):
|
|||||||
if self.freqai_info["data_split_parameters"]["test_size"] > 0:
|
if self.freqai_info["data_split_parameters"]["test_size"] > 0:
|
||||||
dk.compute_inlier_metric(set_='test')
|
dk.compute_inlier_metric(set_='test')
|
||||||
|
|
||||||
|
if self.freqai_info["feature_parameters"].get('noise_standard_deviation', 0):
|
||||||
|
dk.add_noise_to_training_features()
|
||||||
|
|
||||||
def data_cleaning_predict(self, dk: FreqaiDataKitchen, dataframe: DataFrame) -> None:
|
def data_cleaning_predict(self, dk: FreqaiDataKitchen, dataframe: DataFrame) -> None:
|
||||||
"""
|
"""
|
||||||
Base data cleaning method for predict.
|
Base data cleaning method for predict.
|
||||||
These functions each modify dk.do_predict, which is a dataframe with equal length
|
Functions here are complementary to the functions of data_cleaning_train.
|
||||||
to the number of candles coming from and returning to the strategy. Inside do_predict,
|
|
||||||
1 allows prediction and < 0 signals to the strategy that the model is not confident in
|
|
||||||
the prediction.
|
|
||||||
See FreqaiDataKitchen::remove_outliers() for an example
|
|
||||||
of how the do_predict vector is modified. do_predict is ultimately passed back to strategy
|
|
||||||
for buy signals.
|
|
||||||
"""
|
"""
|
||||||
ft_params = self.freqai_info["feature_parameters"]
|
ft_params = self.freqai_info["feature_parameters"]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user