You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The do_magic() method returns both a compiled model and the train/test split and reshaped data.
The data goes through a series of processes that transform a pandas DataFrame into numpy arrays, with the X being an array of time windows of size n_steps from the dataframe feature columns, and the y being the corresponding labels in the dataset's ['y'] column.
Data format
The data provided to the EasyLSTM's __init__ method has to be a pandas dataframe in the following format:
The number of features/feature columns can be any number, as long as there is a at least one feature and a 'y' column
Sample DataFrame
Note: All feature columns can be named freely, just the label column that needs to be named 'y'
feature_0
feature_1
some_other_feature
y
0.1
2.12
1600
0.2
0.2
3.15
3000
0.3
0.3
3.98
400
0.4
7 Lines from import to prediction example
fromeasy_lstmimportEasyLSTMimportpandasdataset=pandas.read_csv('./path_to_dataset.csv')
dataset['y'] =dataset['feature'].shift(-1, axis=0)[:-1] #Turning a time series into a supervised learning problemmodel, X_train, y_train, X_test, y_test=EasyLSTM(data=dataset, n_steps=4).do_magic()
model.fit(X_train, y_train, epochs=20)
predictions=model.predict(X_test)