Skip to content

Commit

Permalink
feat(timeseries): TimeSeries dataset preprocessing.
Browse files Browse the repository at this point in the history
  • Loading branch information
fabclmnt committed Jan 24, 2021
1 parent b3d6df9 commit 6ad8132
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ydata_synthetic/preprocessing/timeseries/stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ def transformations(seq_len: int):
# Reading the stock data
stock_df = pd.read_csv('../data/stock.csv')

stock_df = stock_df.set_index('Date').sort_index()
#Data transformations to be applied prior to be used with the synthesizer model
processed_data = real_data_loading(stock_df, seq_len=seq_len)
processed_data = real_data_loading(stock_df.values, seq_len=seq_len)

return processed_data
3 changes: 2 additions & 1 deletion src/ydata_synthetic/preprocessing/timeseries/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def real_data_loading(data: np.array, seq_len):
# Flip the data to make chronological data
ori_data = data[::-1]
# Normalize the data
ori_data = MinMaxScaler(ori_data)
scaler = MinMaxScaler().fit(ori_data)
ori_data = scaler.transform(ori_data)

# Preprocess the dataset
temp_data = []
Expand Down

0 comments on commit 6ad8132

Please sign in to comment.