- TensorFlow >= 2.0
- Scikit-learn
- Keras
- Pandas
- Numpy
from easy_lstm import EasyLSTM
helper = EasyLSTM(data, timesteps)
model, X_train, y_train, X_test, y_test = helper.do_magic()
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.
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
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 |
from easy_lstm import EasyLSTM
import pandas
dataset = pandas.read_csv('./path_to_dataset.csv')
dataset['y'] = dataset['feature'].shift(-1, axis=0)[:-1] #Turning a time series into a supervised learning problem
model, 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)