Keras-based wrapper classes for DNNs geared toward making real-time predictions on non-linear time series data. Eventually intended to be deployed onto FPGA architectures for real-time state estimation applications.
The aim of this project is to create a library of online machine learning models for making predictions on real-time time series data streams. Online machine learning is a machine learning approach that involves training on samples sequentially as they become available. Presently, a working online implementation of a multilayer perception (MLP) is included in this project; however, the aim is to do same for other machine learning models typically used in time series analysis.
First, to install dependencies in a conda environment, clone this repository and run
conda env create -n rtml -f environment.yml
conda activate rtmlTo launch a training session, run
python benchmark.pyBy default, this will train a multilayer perceptron neural network online with the following configuration
input dimension = 10
hidden layers = 1 with 10 neurons
epochs per new observation = 1
optimizer = adam
loss = mse
that predicts 5 timesteps into the future on the experimentally generated vibration signal in the datasets/ folder.
The command line arguments for benchmark.py are as follows:
--history-length: the number of past observations to be fed into the model as training data. This will correspond theinput_dimof the MLP. Default:10--forecast-length: number of timesteps into the future to predict at. Default:5--hidden-layers: a series of integers specifying the number of neurons in eachDensehidden layer of the MLP. Specifying--hidden-layers 30 20 10would sequentially create threeDensehidden layers of sizes 30, 20, and 10. For now, each hidden layer is hardcoded to usereluas its activation function. Default:10--epochs-per-sample: number of epochs to train the model at each timestep. Default:1--save: if specified, saves results of training session to a.csvfile.
By default, benchmark.py produces lines of output in the following csv format
{history length},{forecast length},{hidden layers},{epochs per sample},{current timestep},{current sample},{timestep being predicted at},{prediction}until the model has fully traversed the training data. The utils.metrics module provides a Pandas adapter class called
MetricsAdapter that allows analyses of the data outputted by this script. In the future, a Jupyter Notebook will be
included in this repository to demonstrate how to work with this class.
This project is funded by the National Science Foundation as part of the University of South Carolina's Real-Time Machine Learning initiative. It is also a significant refactor of the now-deprecated OnlineMLP.