Commit fdc34db0 authored by lucas_miranda's avatar lucas_miranda
Browse files

Implemented shuffle parameter in preprocessing; shuffled validation data in model_training.py

parent 70b60e20
...@@ -294,6 +294,7 @@ input_dict_val = { ...@@ -294,6 +294,7 @@ input_dict_val = {
random_state=42, random_state=42,
filter="gaussian", filter="gaussian",
sigma=55, sigma=55,
shuffle=True,
), ),
"dists": distances2.preprocess( "dists": distances2.preprocess(
window_size=11, window_size=11,
...@@ -302,6 +303,7 @@ input_dict_val = { ...@@ -302,6 +303,7 @@ input_dict_val = {
random_state=42, random_state=42,
filter="gaussian", filter="gaussian",
sigma=55, sigma=55,
shuffle=True,
), ),
"angles": angles2.preprocess( "angles": angles2.preprocess(
window_size=11, window_size=11,
...@@ -310,6 +312,7 @@ input_dict_val = { ...@@ -310,6 +312,7 @@ input_dict_val = {
random_state=42, random_state=42,
filter="gaussian", filter="gaussian",
sigma=55, sigma=55,
shuffle=True,
), ),
"coords+dist": coords_distances2.preprocess( "coords+dist": coords_distances2.preprocess(
window_size=11, window_size=11,
...@@ -318,6 +321,7 @@ input_dict_val = { ...@@ -318,6 +321,7 @@ input_dict_val = {
random_state=42, random_state=42,
filter="gaussian", filter="gaussian",
sigma=55, sigma=55,
shuffle=True,
), ),
"coords+angle": coords_angles2.preprocess( "coords+angle": coords_angles2.preprocess(
window_size=11, window_size=11,
...@@ -326,6 +330,7 @@ input_dict_val = { ...@@ -326,6 +330,7 @@ input_dict_val = {
random_state=42, random_state=42,
filter="gaussian", filter="gaussian",
sigma=55, sigma=55,
shuffle=True,
), ),
"coords+dist+angle": coords_dist_angles2.preprocess( "coords+dist+angle": coords_dist_angles2.preprocess(
window_size=11, window_size=11,
...@@ -334,6 +339,7 @@ input_dict_val = { ...@@ -334,6 +339,7 @@ input_dict_val = {
random_state=42, random_state=42,
filter="gaussian", filter="gaussian",
sigma=55, sigma=55,
shuffle=True,
), ),
} }
......
...@@ -472,6 +472,7 @@ class table_dict(dict): ...@@ -472,6 +472,7 @@ class table_dict(dict):
sigma=None, sigma=None,
shift=0, shift=0,
standard_scaler=True, standard_scaler=True,
shuffle=False,
): ):
"""Builds a sliding window. If desired, splits train and test and """Builds a sliding window. If desired, splits train and test and
Z-scores the data using sklearn's standard scaler""" Z-scores the data using sklearn's standard scaler"""
...@@ -532,8 +533,15 @@ class table_dict(dict): ...@@ -532,8 +533,15 @@ class table_dict(dict):
if filter == "gaussian": if filter == "gaussian":
X_test = X_test * g.reshape(1, window_size, 1) X_test = X_test * g.reshape(1, window_size, 1)
if shuffle:
X_train = np.random.choice(X_train, X_train.shape[0], replace=False)
X_test = np.random.choice(X_test, X_test.shape[0], replace=False)
return X_train, X_test return X_train, X_test
if shuffle:
X_train = np.random.choice(X_train, X_train.shape[0], replace=False)
return X_train return X_train
def random_projection(self, n_components=None, sample=1000): def random_projection(self, n_components=None, sample=1000):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment