|
| TemporalDesignMatrix (DesignMatrix< VarType > const &designMatrix, size_t const timeColumnIndex, string const timeName="time", vector< string > const &columnNames=vector< string >(0)) |
| Build a TemporalDesignMatrix from given DesignMatrix and specified time column. More...
|
|
| TemporalDesignMatrix (DesignMatrix< VarType > const &designMatrix, arma::Col< TimeType > const &timeVector, string const timeName="time") |
| Build a TemporalDesignMatrix from given DesignMatrix and time vector. More...
|
|
| TemporalDesignMatrix (arma::Mat< VarType > const &X, size_t const timeColumnIndex, string const timeName="time", vector< string > const &columnNames=vector< string >(0)) |
| Build a TemporalDesignMatrix from given \(X\) matrix and specified time column. More...
|
|
| TemporalDesignMatrix (arma::Mat< VarType > const &X, arma::Col< TimeType > const &t, string const timeName="time", vector< string > const &columnNames=vector< string >(0)) |
| Build a TemporalDesignMatrix from given DesignMatrix \(X\) and time vector \(\vec{t}\). More...
|
|
| TemporalDesignMatrix (string const &path, string const &sep=",", string const &timeName="time") |
| Build a TemporalDesignMatrix from data in file at given path and specified time column. More...
|
|
TimeType & | operator[] (size_t const i) |
| Access to the \(t_{i}\) component of the \(\vec{t}\) time vector. More...
|
|
DiffDesignMatrix< TimeType, VarType > | toDiffDesignMatrix (DiffDesignMatrixType diffType=DiffDesignMatrixType::FORWARD_FINITE_DIFFERENCES, bool const sort=true) const |
| Build a DiffDesignMatrix from the TemporalDesignMatrix. More...
|
|
shared_ptr< DiffDesignMatrix< TimeType, VarType > > | toDiffDesignMatrixPointer (DiffDesignMatrixType diffType=DiffDesignMatrixType::FORWARD_FINITE_DIFFERENCES, bool const sort=true) const |
| Like fluxionum::TemporalDesignMatrix::toDiffDesignMatrix but returning a pointer to the object. More...
|
|
void | mergeInPlace (DesignMatrix< VarType > const &dm) override |
| Extend DesignMatrix::mergeInPlace method so the time values are also merged. More...
|
|
void | dropRows (arma::uvec const &indices) override |
| Extend DesignMatrix::dropRows(arma::uvec const &) method so the time values are also dropped. More...
|
|
virtual void | shiftTime (TimeType const x) |
| Add given time \(x\) to all time values in vector \(\vec{t}\). More...
|
|
virtual void | sortByTime () |
| Sort all rows of \(X\) matrix and all components of \(\vec{t}\) vector so \(t_{i+1} > t_{i}\) \(vec{t}\), considering the row \(X(i,:)\) is associated with the time component \(t_i\).
|
|
virtual size_t | slopeFilter (VarType const tau) |
| Apply a filter based on the first derivative understood as the slope. More...
|
|
arma::Col< TimeType > const & | getTimeVector () const |
| Obtain a constant/read reference to the time vector \(\vec{t}\). More...
|
|
string const & | getTimeName () const |
| Obtain the name of the time attribute. More...
|
|
void | setTimeName (string const &timeName) |
| Set the name of the time attribute. More...
|
|
| DesignMatrix (vector< string > const &columnNames=vector< string >(0)) |
| Build a DesignMatrix with no data. More...
|
|
| DesignMatrix (arma::Mat< VarType > const &X, vector< string > const &columnNames=vector< string >(0)) |
| Build a DesignMatrix from given armadillo matrix. More...
|
|
| DesignMatrix (string const &path, string const &sep=",") |
| Build a DesignMatrix from data in file at given path. More...
|
|
VarType & | operator() (size_t const i, size_t const j) override |
| Access to the \(x_{ij}\) component of the \(X\) design matrix. More...
|
|
virtual void | mergeInPlace (DesignMatrix const &dm) |
| Merge given DesignMatrix into this DesignMatrix. More...
|
|
void | swapColumns (vector< long unsigned int > const &indices) |
|
void | swapColumns (vector< unsigned long long > const &indices) |
|
void | swapColumns (arma::uvec const &indices) |
| Swap the columns of the DesignMatrix. More...
|
|
void | dropColumns (vector< long unsigned int > const &indices) |
|
void | dropColumns (vector< unsigned long long > const &indices) |
|
void | dropColumns (arma::uvec const &indices) |
| Remove the columns from the DesignMatrix. More...
|
|
void | dropRows (vector< long unsigned int > const &indices) |
|
void | dropRows (vector< unsigned long long > const &indices) |
|
void | addToColumn (size_t const colIdx, VarType const x) |
| Add \(x\) to all elements of \(j\)-th column. More...
|
|
arma::Mat< VarType > const & | getX () const |
| Obtain a constant/read reference to the \(X\) matrix. More...
|
|
arma::Mat< VarType > & | getWritableX () |
| Obtain a writable reference to the \(X\) matrix. More...
|
|
size_t | getNumRows () const override |
| Obtain the number of rows of the DesignMatrix \(X\). More...
|
|
size_t | getNumColumns () const override |
| Obtain the number of columns of the DesignMatrix \(X\). More...
|
|
size_t | getNumElements () const override |
| Obtain the number of elements of the DesignMatrix \(X\). More...
|
|
arma::subview_row< VarType > const | getRow (size_t const i) const |
| Obtain the \(i\)-th row of the DesignMatrix \(X\). More...
|
|
arma::Row< VarType > | getRowCopy (size_t const i) const |
| Like DesignMatrix::getRow(size_t const) but returning a copy by value instead of a view-like reference. More...
|
|
arma::subview_col< VarType > const | getColumn (size_t const j) const |
| Obtain the \(j\)-th column of the DesignMatrix \(X\). More...
|
|
arma::subview_col< VarType > const | getColumn (string const &columnName) const |
| Like the fluxionum::DesignMatrix::getColumn(size_t const) method but specifying the column by name. More...
|
|
arma::Col< VarType > | getColumnCopy (size_t const j) const |
| Like DesignMatrix::getColumn(size_t const) but returning a copy by value instead of a view-like reference. More...
|
|
arma::Col< VarType > | getColumnCopy (string const &columnName) const |
| Like DesignMatrix::getColumn(string const &) but returning a copy by value instead of a view-like reference. More...
|
|
void | setColumn (size_t const j, arma::Col< VarType > const &col) |
| Set the \(j\)-th column of the DesignMatrix \(X\). More...
|
|
| AbstractDesignMatrix (vector< string > const &columnNames=vector< string >(0)) |
| Default constructor for the AbstractDesignMatrix. More...
|
|
VarType & | operator() (size_t const i, string const columnName) |
| Like the AbstractDesignMatrix::operator()(size_t const, size_t const) method but specifying the column by its name instead of its index. More...
|
|
bool | hasColumnNames () const |
| Check whether there are available column names for the AbstractDesignMatrix (true) or not (false) More...
|
|
string const & | getColumnName (size_t const j) const |
| Obtain the name of the \(j\)-th column. More...
|
|
void | setColumnName (size_t const j, string const &columnName) |
| Set the name of the \(j\)-th column. More...
|
|
vector< string > const & | getColumnNames () const |
| Obtain a constant/read reference to the column names. More...
|
|
void | setColumnNames (vector< string > const &columnNames) |
| Obtain a constant/read reference to the column names. More...
|
|
template<typename TimeType, typename VarType>
class fluxionum::TemporalDesignMatrix< TimeType, VarType >
This class represents a DesignMatrix where each row satisfy that its elements can be placed into a continuous succession order representation (i.e. continuous time domain). For a discrete succession order representation see fluxionum::IndexedDesignMatrix better.
- Author
- Alberto M. Esmoris Pena
- Version
- 1.0
Let \(x_i\) be the \(i\)-th row of the temporal design matrix such that
\[ \exists j \in \mathbb{Z} \ni \forall i,\, x_i = \left\{ t_{i} = x_{ij}, x_{i}' = \bigg{(} x_{i,1}, \ldots, x_{i,j-1} , x_{i,j+1}, \ldots, x_{i,n} \bigg{)} \right\} \]
For which its valid status constraint can be defined as:
\[ \forall i, t_{i+1} > t_{i} \]
Notice that implicitly implies the following is not allowed:
\[ \exists i \ni t_{i+1} = t_{i} \]
It is, no repeated time values are allowed because they make the TemporalDesignMatrix lose its valid status constraint, thus any calculus involving it is undefined.
Thus, it is expected that a \(\frac{DX}{DT} \in \mathbb{R}^{(m-1) \times n}\) DiffDesignMatrix exists for the concrete state of any valid TemporalDesignMatrix such that:
\[ \frac{DX}{DT} = \left[\begin{array}{ccc} \frac{x_{21}' - x_{11}'}{t_2 - t_1} & \ldots & \frac{x_{2n}' - x_{1n}'}{t_2 - t_1} \\ \vdots & \ddots & \vdots \\ \frac{x_{m1}' - x_{m-1,1}'}{t_m - t_{m-1}} & \ldots & \frac{x_{mn}' - x_{m-1,n}'}{t_m - t_{m-1}} \end{array}\right] \]
- Template Parameters
-
TimeType | The time's domain |
VarType | The non time's domain (basic DesignMatrix domain) |
- See also
- fluxionum::IndexedDesignMatrix
-
fluxionum::DiffDesignMatrix
-
fluxionum::DesignMatrix
template<typename TimeType , typename VarType >
Apply a filter based on the first derivative understood as the slope.
Let \(X \in \mathbb{R}^{m \times n}\) such that \(x_j(t_i) = X(i,j) = x_{ij}\), so it is possible to approximate the derivative as follows:
\[ \frac{\Delta x_j}{\Delta t}(t_i) = \frac{x_j(t_{i+1}) - x_j(t_i)}{t_{i+1} - t_i} \]
But then, the differences between consecutive derivatives can be calculated as shown below:
\[ Dx_j(t_i) = \frac{\Delta x_j}{\Delta t}(t_{i+1}) - \frac{\Delta x_j}{\Delta t}(t_i) \]
Therefore, the vector \(DX(t_i) = \left(Dx_1(t_i), \ldots, Dx_n(t_i)\right)\) arises. And the maximum slope difference at time \(t_i\) can be defined as the maximum absolute component from the vector \(DX(t_i)\) such that \(d_i^* = \max_{1 \leq j \leq n} \vert{Dx_j(t_i)}\vert\).
Finally, let \(\tau\) be the slope difference threshold. Thus, always that \(d_i^* > \tau\) the \(i+1\) row/point will be removed from matrix \(X\) as it is considered that it does not bring useful enough information.
- Parameters
-
tau | The threshold \(\tau\) to decide whether to preserver or to discard a row/point |
- Returns
- The number of discarded rows/points