ESP
0.1
The Example-based Sensor Predictions (ESP) system tries to bring machine learning to the maker community.
|
Base class for input streams that provide live sensor data to the ESP system. To use an InputStream instance in your application, pass it to useInputStream() in your setup() function. More...
#include <istream.h>
Public Types | |
using | normalizeFunc = std::function< double(double)> |
using | vectorNormalizeFunc = std::function< vector< double >(vector< double >)> |
typedef std::function< void(GRT::MatrixDouble)> | onDataReadyCallback |
Public Member Functions | |
InputStream () | |
virtual | ~InputStream ()=default |
virtual int | getNumInputDimensions ()=0 |
virtual int | getNumOutputDimensions () |
void | useNormalizer (normalizeFunc f) |
void | useNormalizer (vectorNormalizeFunc f) |
void | onDataReadyEvent (onDataReadyCallback callback) |
template<typename T1 , typename arg , class T > | |
void | onDataReadyEvent (T1 *owner, void(T::*listenerMethod)(arg)) |
void | setLabelsForAllDimensions (const vector< string > labels) |
void | setLabelsForAllDimensions (std::initializer_list< string > list) |
const vector< string > & | getLabels () const |
![]() | |
Stream () | |
virtual bool | start () |
virtual void | stop () |
void | toggle () |
bool | hasStarted () |
Protected Member Functions | |
vector< double > | normalize (vector< double >) |
Protected Attributes | |
vector< string > | InputStream_labels_ |
onDataReadyCallback | data_ready_callback_ |
normalizeFunc | normalizer_ |
vectorNormalizeFunc | vectorNormalizer_ |
![]() | |
std::atomic_bool | has_started_ |
Base class for input streams that provide live sensor data to the ESP system. To use an InputStream instance in your application, pass it to useInputStream() in your setup() function.
using InputStream::normalizeFunc = std::function<double(double)> |
typedef std::function<void(GRT::MatrixDouble)> InputStream::onDataReadyCallback |
using InputStream::vectorNormalizeFunc = std::function<vector<double>(vector<double>)> |
InputStream::InputStream | ( | ) |
|
virtualdefault |
const vector< string > & InputStream::getLabels | ( | ) | const |
|
pure virtual |
Get the number of dimensions of the data that's provided by the input stream (before it's run through the normalizer, if any).
Implemented in OscInputStream, TcpInputStream, FirmataStream, SerialStream, BaseSerialInputStream, AudioFileStream, and AudioStream.
|
inlinevirtual |
|
protected |
|
inline |
|
inline |
void InputStream::setLabelsForAllDimensions | ( | const vector< string > | labels | ) |
void InputStream::setLabelsForAllDimensions | ( | std::initializer_list< string > | list | ) |
|
inline |
|
inline |
|
protected |
|
protected |
|
protected |
|
protected |