Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
Brush::Data::TimeSeries< T > Struct Template Reference

Stores time series data and implements operators over it. More...

#include <timeseries.h>

Collaboration diagram for Brush::Data::TimeSeries< T >:

Public Types

using Scalar = T
 
using EntryType = Eigen::Array<T,Dynamic,1>
 
using ValType = std::vector<EntryType>
 
using TimeType = std::vector<Eigen::ArrayXi>
 

Public Member Functions

 TimeSeries ()=default
 
 TimeSeries (const TimeType &t, const ValType &v)
 
template<typename U , typename V >
TimeSeries operator() (const U &idx, const V &idx2=Eigen::all) const
 return a slice of the data using indices idx
 
auto size () const -> size_t
 
auto rows () const -> size_t
 
auto cols (int i=0) const -> size_t
 
ValType::iterator begin ()
 
ValType::iterator end ()
 
auto cbegin () const
 
auto cend () const
 
TimeType::iterator tbegin ()
 
TimeType::iterator tend ()
 
auto ctbegin () const
 
auto ctend () const
 
template<typename ET = EntryType>
auto transform (std::function< ET(EntryType)> op) const
 
template<typename R = T>
auto reduce (const auto &op) const
 
template<typename C >
auto cast () const
 
auto abs () const
 
auto pow () const
 
auto log () const
 
auto logabs () const
 
auto log1p () const
 
auto ceil () const
 
auto floor () const
 
auto exp () const
 
auto sin () const
 
auto cos () const
 
auto tan () const
 
auto asin () const
 
auto acos () const
 
auto atan () const
 
auto sinh () const
 
auto cosh () const
 
auto tanh () const
 
auto sqrt () const
 
auto sqrtabs () const
 
auto square () const
 
auto median () const
 
auto mean () const
 
auto std () const
 
auto max () const
 
auto min () const
 
auto sum () const
 
auto count () const
 
auto prod () const
 
template<typename T2 >
auto operator* (T2 v)
 
template<typename T2 >
auto before (const TimeSeries< T2 > &t2) const
 
template<typename T2 >
auto after (const TimeSeries< T2 > &t2) const
 
template<typename T2 >
auto during (const TimeSeries< T2 > &t2) const
 
std::string print () const
 

Public Attributes

TimeType time
 
ValType value
 

Static Public Attributes

static const size_t NumDimensions =2
 

Detailed Description

template<class T>
struct Brush::Data::TimeSeries< T >

Stores time series data and implements operators over it.

TimeSeries contains two members: time and value, that have the same shape. Both are std::vectors of eigen arrays.

Each element of the vector is intended to represent one person / sample. The values in that element (an Eigen array) are observations of value at time t.

Template Parameters
Tthe scalar type of the underlying values.

Definition at line 25 of file timeseries.h.

Member Typedef Documentation

◆ EntryType

template<class T >
using Brush::Data::TimeSeries< T >::EntryType = Eigen::Array<T,Dynamic,1>

Definition at line 29 of file timeseries.h.

◆ Scalar

template<class T >
using Brush::Data::TimeSeries< T >::Scalar = T

Definition at line 27 of file timeseries.h.

◆ TimeType

template<class T >
using Brush::Data::TimeSeries< T >::TimeType = std::vector<Eigen::ArrayXi>

Definition at line 31 of file timeseries.h.

◆ ValType

template<class T >
using Brush::Data::TimeSeries< T >::ValType = std::vector<EntryType>

Definition at line 30 of file timeseries.h.

Constructor & Destructor Documentation

◆ TimeSeries() [1/2]

template<class T >
Brush::Data::TimeSeries< T >::TimeSeries ( )
default

Wraps time and value slices to matrices TODO: define begin() and end() iterators? figure out how to handle operators that just use values versus time

Here is the caller graph for this function:

◆ TimeSeries() [2/2]

template<class T >
Brush::Data::TimeSeries< T >::TimeSeries ( const TimeType & t,
const ValType & v )
inline

Definition at line 40 of file timeseries.h.

Member Function Documentation

◆ abs()

template<class T >
auto Brush::Data::TimeSeries< T >::abs ( ) const
inline

Definition at line 110 of file timeseries.h.

Here is the call graph for this function:

◆ acos()

template<class T >
auto Brush::Data::TimeSeries< T >::acos ( ) const
inline

Definition at line 122 of file timeseries.h.

Here is the call graph for this function:

◆ after()

template<class T >
template<typename T2 >
auto Brush::Data::TimeSeries< T >::after ( const TimeSeries< T2 > & t2) const
inline

Definition at line 156 of file timeseries.h.

◆ asin()

template<class T >
auto Brush::Data::TimeSeries< T >::asin ( ) const
inline

Definition at line 121 of file timeseries.h.

Here is the call graph for this function:

◆ atan()

template<class T >
auto Brush::Data::TimeSeries< T >::atan ( ) const
inline

Definition at line 123 of file timeseries.h.

Here is the call graph for this function:

◆ before()

template<class T >
template<typename T2 >
auto Brush::Data::TimeSeries< T >::before ( const TimeSeries< T2 > & t2) const
inline

Definition at line 150 of file timeseries.h.

◆ begin()

template<class T >
ValType::iterator Brush::Data::TimeSeries< T >::begin ( )
inline

Definition at line 60 of file timeseries.h.

◆ cast()

template<class T >
template<typename C >
auto Brush::Data::TimeSeries< T >::cast ( ) const
inline

Definition at line 103 of file timeseries.h.

Here is the call graph for this function:

◆ cbegin()

template<class T >
auto Brush::Data::TimeSeries< T >::cbegin ( ) const
inline

Definition at line 62 of file timeseries.h.

Here is the caller graph for this function:

◆ ceil()

template<class T >
auto Brush::Data::TimeSeries< T >::ceil ( ) const
inline

Definition at line 115 of file timeseries.h.

Here is the call graph for this function:

◆ cend()

template<class T >
auto Brush::Data::TimeSeries< T >::cend ( ) const
inline

Definition at line 63 of file timeseries.h.

Here is the caller graph for this function:

◆ cols()

template<class T >
auto Brush::Data::TimeSeries< T >::cols ( int i = 0) const -> size_t
inline

Definition at line 54 of file timeseries.h.

Here is the call graph for this function:

◆ cos()

template<class T >
auto Brush::Data::TimeSeries< T >::cos ( ) const
inline

Definition at line 119 of file timeseries.h.

Here is the call graph for this function:

◆ cosh()

template<class T >
auto Brush::Data::TimeSeries< T >::cosh ( ) const
inline

Definition at line 125 of file timeseries.h.

Here is the call graph for this function:

◆ count()

template<class T >
auto Brush::Data::TimeSeries< T >::count ( ) const
inline

Definition at line 137 of file timeseries.h.

Here is the call graph for this function:

◆ ctbegin()

template<class T >
auto Brush::Data::TimeSeries< T >::ctbegin ( ) const
inline

Definition at line 66 of file timeseries.h.

◆ ctend()

template<class T >
auto Brush::Data::TimeSeries< T >::ctend ( ) const
inline

Definition at line 67 of file timeseries.h.

◆ during()

template<class T >
template<typename T2 >
auto Brush::Data::TimeSeries< T >::during ( const TimeSeries< T2 > & t2) const
inline

Definition at line 162 of file timeseries.h.

◆ end()

template<class T >
ValType::iterator Brush::Data::TimeSeries< T >::end ( )
inline

Definition at line 61 of file timeseries.h.

◆ exp()

template<class T >
auto Brush::Data::TimeSeries< T >::exp ( ) const
inline

Definition at line 117 of file timeseries.h.

Here is the call graph for this function:

◆ floor()

template<class T >
auto Brush::Data::TimeSeries< T >::floor ( ) const
inline

Definition at line 116 of file timeseries.h.

Here is the call graph for this function:

◆ log()

template<class T >
auto Brush::Data::TimeSeries< T >::log ( ) const
inline

Definition at line 112 of file timeseries.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ log1p()

template<class T >
auto Brush::Data::TimeSeries< T >::log1p ( ) const
inline

Definition at line 114 of file timeseries.h.

Here is the call graph for this function:

◆ logabs()

template<class T >
auto Brush::Data::TimeSeries< T >::logabs ( ) const
inline

Definition at line 113 of file timeseries.h.

Here is the call graph for this function:

◆ max()

template<class T >
auto Brush::Data::TimeSeries< T >::max ( ) const
inline

Definition at line 134 of file timeseries.h.

Here is the call graph for this function:

◆ mean()

template<class T >
auto Brush::Data::TimeSeries< T >::mean ( ) const
inline

Definition at line 132 of file timeseries.h.

Here is the call graph for this function:

◆ median()

template<class T >
auto Brush::Data::TimeSeries< T >::median ( ) const
inline

Definition at line 131 of file timeseries.h.

Here is the call graph for this function:

◆ min()

template<class T >
auto Brush::Data::TimeSeries< T >::min ( ) const
inline

Definition at line 135 of file timeseries.h.

Here is the call graph for this function:

◆ operator()()

template<class T >
template<typename U , typename V >
TimeSeries Brush::Data::TimeSeries< T >::operator() ( const U & idx,
const V & idx2 = Eigen::all ) const
inline

return a slice of the data using indices idx

Definition at line 45 of file timeseries.h.

Here is the call graph for this function:

◆ operator*()

template<class T >
template<typename T2 >
auto Brush::Data::TimeSeries< T >::operator* ( T2 v)
inline

Definition at line 144 of file timeseries.h.

Here is the call graph for this function:

◆ pow()

template<class T >
auto Brush::Data::TimeSeries< T >::pow ( ) const
inline

Definition at line 111 of file timeseries.h.

Here is the call graph for this function:

◆ print()

template<class T >
std::string Brush::Data::TimeSeries< T >::print ( ) const
inline

Print the time series.

Parameters
outputostream object
tstime series object
Returns
ostream&

Definition at line 168 of file timeseries.h.

Here is the call graph for this function:

◆ prod()

template<class T >
auto Brush::Data::TimeSeries< T >::prod ( ) const
inline

Definition at line 138 of file timeseries.h.

Here is the call graph for this function:

◆ reduce()

template<class T >
template<typename R = T>
auto Brush::Data::TimeSeries< T >::reduce ( const auto & op) const
inline

Definition at line 90 of file timeseries.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rows()

template<class T >
auto Brush::Data::TimeSeries< T >::rows ( ) const -> size_t
inline

Definition at line 53 of file timeseries.h.

◆ sin()

template<class T >
auto Brush::Data::TimeSeries< T >::sin ( ) const
inline

Definition at line 118 of file timeseries.h.

Here is the call graph for this function:

◆ sinh()

template<class T >
auto Brush::Data::TimeSeries< T >::sinh ( ) const
inline

Definition at line 124 of file timeseries.h.

Here is the call graph for this function:

◆ size()

template<class T >
auto Brush::Data::TimeSeries< T >::size ( ) const -> size_t
inline

Definition at line 52 of file timeseries.h.

◆ sqrt()

template<class T >
auto Brush::Data::TimeSeries< T >::sqrt ( ) const
inline

Definition at line 127 of file timeseries.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sqrtabs()

template<class T >
auto Brush::Data::TimeSeries< T >::sqrtabs ( ) const
inline

Definition at line 128 of file timeseries.h.

Here is the call graph for this function:

◆ square()

template<class T >
auto Brush::Data::TimeSeries< T >::square ( ) const
inline

Definition at line 129 of file timeseries.h.

Here is the call graph for this function:

◆ std()

template<class T >
auto Brush::Data::TimeSeries< T >::std ( ) const
inline

Definition at line 133 of file timeseries.h.

Here is the call graph for this function:

◆ sum()

template<class T >
auto Brush::Data::TimeSeries< T >::sum ( ) const
inline

Definition at line 136 of file timeseries.h.

Here is the call graph for this function:

◆ tan()

template<class T >
auto Brush::Data::TimeSeries< T >::tan ( ) const
inline

Definition at line 120 of file timeseries.h.

Here is the call graph for this function:

◆ tanh()

template<class T >
auto Brush::Data::TimeSeries< T >::tanh ( ) const
inline

Definition at line 126 of file timeseries.h.

Here is the call graph for this function:

◆ tbegin()

template<class T >
TimeType::iterator Brush::Data::TimeSeries< T >::tbegin ( )
inline

Definition at line 64 of file timeseries.h.

◆ tend()

template<class T >
TimeType::iterator Brush::Data::TimeSeries< T >::tend ( )
inline

Definition at line 65 of file timeseries.h.

◆ transform()

template<class T >
template<typename ET = EntryType>
auto Brush::Data::TimeSeries< T >::transform ( std::function< ET(EntryType)> op) const
inline

Definition at line 78 of file timeseries.h.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ NumDimensions

template<class T >
const size_t Brush::Data::TimeSeries< T >::NumDimensions =2
static

Definition at line 28 of file timeseries.h.

◆ time

template<class T >
TimeType Brush::Data::TimeSeries< T >::time

Definition at line 37 of file timeseries.h.

◆ value

template<class T >
ValType Brush::Data::TimeSeries< T >::value

Definition at line 38 of file timeseries.h.


The documentation for this struct was generated from the following file: