Skip to content

Commit

Permalink
updated(src): Update functions and models with new windowed function.
Browse files Browse the repository at this point in the history
  • Loading branch information
AndresLaverdeMarin committed Sep 5, 2022
1 parent 2620acd commit ca3bf02
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/data/Li_et_al_processed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ def _create_trip_windows(windows_size: int, list_dfs: list) -> list:
final_list = []
for df in list_dfs:
size = windows_size + 1
list_of_dfs = [df.iloc[i : i + size - 1, :] for i in range(0, len(df), size)]
list_of_dfs = [df.iloc[i - 1: i + size - 2, :] for i in range(1, len(df) + 1, size-1)]
for trip in list_of_dfs:
if len(trip) == windows_size:
final_list.extend([trip])

return final_list



def read(path, scaler_path, window_size):
"""
Parameters
Expand Down
8 changes: 7 additions & 1 deletion src/data/processed_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def _create_trip_windows(windows_size: int, list_dfs: list) -> list:
final_list = []
for df in list_dfs:
size = windows_size + 1
list_of_dfs = [df.iloc[i : i + size - 1, :] for i in range(0, len(df), size)]
list_of_dfs = [df.iloc[i - 1: i + size - 2, :] for i in range(1, len(df) + 1, size-1)]
for trip in list_of_dfs:
if len(trip) == windows_size:
final_list.extend([trip])
Expand Down Expand Up @@ -126,3 +126,9 @@ def read(path, scaler_path, window_size):
X = np.array([scaler.transform(X_tot[i]) for i in range(0, len(X_tot))])

return X, y


if __name__ == "__main__":
X, y = read(f"../../data/AstaZero_driver_{1}.csv", "../final_models/scaler_biLSTM_5s.pkl", 5)


Binary file modified src/final_models/Li_et_al_LSTM_5s.h5
Binary file not shown.
Binary file modified src/final_models/biLSTM_5s.h5
Binary file not shown.
Binary file modified src/final_models/scaler_Li_et_al_LSTM_5s.pkl
Binary file not shown.

0 comments on commit ca3bf02

Please sign in to comment.