rollback to the original add noise
This commit is contained in:
parent
b42d396a01
commit
dd0713e80f
@ -884,25 +884,11 @@ class FreqaiDataKitchen:
|
|||||||
"""
|
"""
|
||||||
Add noise to train features to reduce the risk of overfitting.
|
Add noise to train features to reduce the risk of overfitting.
|
||||||
"""
|
"""
|
||||||
da = self.freqai_config["feature_parameters"]["data_augment"]
|
mu = 0 # no shift
|
||||||
X = self.data_dictionary['train_features']
|
sigma = self.freqai_config["feature_parameters"]["noise_standard_deviation"]
|
||||||
y = self.data_dictionary['train_labels']
|
compute_df = self.data_dictionary['train_features']
|
||||||
da_type = da.get("type", "std")
|
noise = np.random.normal(mu, sigma, [compute_df.shape[0], compute_df.shape[1]])
|
||||||
if da_type == "std":
|
self.data_dictionary['train_features'] += noise
|
||||||
# generate alpha values of 0-mean and 1-std
|
|
||||||
alpha = np.random.randn(*X.shape)
|
|
||||||
scale = da.get("vaue", 0.01)
|
|
||||||
Xaugmented = X + alpha * scale * X.std(0)[None, :]
|
|
||||||
X = np.vstack((X, Xaugmented))
|
|
||||||
y = y.append(y)
|
|
||||||
self.data_dictionary['train_features'] = X
|
|
||||||
self.data_dictionary['train_labels'] = y
|
|
||||||
elif da_type == "constant":
|
|
||||||
mu = 0 # no shift
|
|
||||||
sigma = self.freqai_config["feature_parameters"]["data_augment"]["value"]
|
|
||||||
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
|
return
|
||||||
|
|
||||||
def find_features(self, dataframe: DataFrame) -> None:
|
def find_features(self, dataframe: DataFrame) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user