Skip to content
Snippets Groups Projects
Commit d5ce6f0f authored by tomrink's avatar tomrink
Browse files

minor

parent 0b556266
No related branches found
No related tags found
No related merge requests found
......@@ -1312,7 +1312,7 @@ def split_data(num_obs, perc=0.2, skip=1, shuffle=True, seed=None):
return train_idxs[::skip], test_idxs[::skip]
def normalize(data, param, mean_std_dict):
def normalize(data, param, mean_std_dict, add_noise=False, noise_scale=1.0, seed=None):
if mean_std_dict.get(param) is None:
return data
......@@ -1324,6 +1324,12 @@ def normalize(data, param, mean_std_dict):
data -= mean
data /= std
if add_noise:
if seed is not None:
np.random.seed(seed)
rnd = np.random.normal(loc=0, scale=noise_scale, size=data.size)
data += rnd
not_valid = np.isnan(data)
data[not_valid] = 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment