Txeo v0.1
A Developer-Friendly TensorFlow C++ Wrapper
Loading...
Searching...
No Matches
txeo::DataTable< T > Class Template Reference

A container for managing training, evaluation, and test data splits. More...

#include <DataTable.h>

Collaboration diagram for txeo::DataTable< T >:
Collaboration graph

Public Member Functions

 ~DataTable ()=default
 
 DataTable (const DataTable &)=default
 
 DataTable (DataTable &&)=default
 
DataTableoperator= (const DataTable &)=default
 
DataTableoperator= (DataTable &&)=default
 
 DataTable (txeo::Matrix< T > &&data, std::vector< size_t > x_cols, std::vector< size_t > y_cols)
 Construct a DataTable with specified feature/label columns.
 
 DataTable (const txeo::Matrix< T > &data, std::vector< size_t > x_cols, std::vector< size_t > y_cols)
 
 DataTable (txeo::Matrix< T > &&data, std::vector< size_t > y_cols)
 Construct a DataTable with specified label columns. All the remaining columns are considered features.
 
 DataTable (const txeo::Matrix< T > &data, std::vector< size_t > y_cols)
 
 DataTable (txeo::Matrix< T > &&data, std::vector< size_t > x_cols, std::vector< size_t > y_cols, size_t eval_percent)
 Construct a DataTable with specified feature/label columns and evaluation split percentage.
 
 DataTable (const txeo::Matrix< T > &data, std::vector< size_t > x_cols, std::vector< size_t > y_cols, size_t eval_percent)
 
 DataTable (txeo::Matrix< T > &&data, std::vector< size_t > y_cols, size_t eval_percent)
 Construct a DataTable with specified label columns and evaluation split percentage. All the remaining columns are considered x features.
 
 DataTable (const txeo::Matrix< T > &data, std::vector< size_t > y_cols, size_t eval_percent)
 
 DataTable (txeo::Matrix< T > &&data, std::vector< size_t > x_cols, std::vector< size_t > y_cols, size_t eval_percent, size_t eval_test)
 Construct a DataTable with specified feature/label columns and evaluation/test split percentages.
 
 DataTable (const txeo::Matrix< T > &data, std::vector< size_t > x_cols, std::vector< size_t > y_cols, size_t eval_percent, size_t eval_test)
 
 DataTable (txeo::Matrix< T > &&data, std::vector< size_t > y_cols, size_t eval_percent, size_t eval_test)
 Construct a DataTable with specified label columns and evaluation/test split percentages. All the remaining columns are considered x features.
 
 DataTable (const txeo::Matrix< T > &data, std::vector< size_t > y_cols, size_t eval_percent, size_t eval_test)
 
 DataTable (txeo::Matrix< T > &&x_train, txeo::Matrix< T > &&y_train, txeo::Matrix< T > &&x_eval, txeo::Matrix< T > &&y_eval, txeo::Matrix< T > &&x_test, txeo::Matrix< T > &&y_test)
 
 DataTable (const txeo::Matrix< T > &x_train, const txeo::Matrix< T > &y_train, const txeo::Matrix< T > &x_eval, const txeo::Matrix< T > &y_eval, const txeo::Matrix< T > &x_test, const txeo::Matrix< T > &y_test)
 
 DataTable (txeo::Matrix< T > &&x_train, txeo::Matrix< T > &&y_train, txeo::Matrix< T > &&x_eval, txeo::Matrix< T > &&y_eval)
 
 DataTable (const txeo::Matrix< T > &x_train, const txeo::Matrix< T > &y_train, const txeo::Matrix< T > &x_eval, const txeo::Matrix< T > &y_eval)
 
 DataTable (txeo::Matrix< T > &&x_train, txeo::Matrix< T > &&y_train)
 
 DataTable (const txeo::Matrix< T > &x_train, const txeo::Matrix< T > &y_train)
 
const txeo::Matrix< T > & x_train () const
 Returns training inputs matrix.
 
const txeo::Matrix< T > & y_train () const
 Returns training outputs matrix.
 
const txeo::Matrix< T > * x_eval () const
 Returns a pointer to evaluation input matrix.
 
const txeo::Matrix< T > * y_eval () const
 Returns a pointer to evaluation output matrix.
 
const txeo::Matrix< T > * x_test () const
 Returns a pointer to test input matrix.
 
const txeo::Matrix< T > * y_test () const
 Returns a pointer to test output matrix.
 
size_t x_dim () const
 Returns the number of input columns.
 
size_t y_dim () const
 Returns the number of output columns.
 
size_t row_size () const
 Returns the number of training rows.
 
bool has_eval () const
 
bool has_test () const
 
DataTable< Tclone () const
 

Detailed Description

template<typename T>
class txeo::DataTable< T >

A container for managing training, evaluation, and test data splits.

Template Parameters
TThe data type stored in the Matrix (e.g., float, double)

This class handles the division of a dataset into training, evaluation, and test sets based on specified column indices and percentage splits.

Examples
/opt/build/repo/include/txeo/DataTable.h.

Definition at line 24 of file DataTable.h.

Constructor & Destructor Documentation

◆ ~DataTable()

◆ DataTable() [1/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const DataTable< T > &  )
default

◆ DataTable() [2/20]

template<typename T >
txeo::DataTable< T >::DataTable ( DataTable< T > &&  )
default

◆ DataTable() [3/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  data,
std::vector< size_t x_cols,
std::vector< size_t y_cols 
)

Construct a DataTable with specified feature/label columns.

Parameters
dataInput matrix containing all data points
x_colsColumn indices for feature columns
y_colsColumn indices for label columns
Exceptions
DataTableError

Example Usage:

txeo::Matrix<double> data = {{1, 2, 3},
{4, 5, 6},
{7, 8, 9}};
// Columns 0-1 as features, column 2 as label
DataTable<double> dt(data, {0,1}, {2});
assert(dt.x_train().cols() == 2);
assert(dt.y_train().cols() == 1);
A container for managing training, evaluation, and test data splits.
Definition DataTable.h:24

◆ DataTable() [4/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  data,
std::vector< size_t x_cols,
std::vector< size_t y_cols 
)
inline

Definition at line 55 of file DataTable.h.

56 : DataTable{std::move(data.clone()), x_cols, y_cols} {};
DataTable(const DataTable &)=default
DataTable< T > clone() const

◆ DataTable() [5/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  data,
std::vector< size_t y_cols 
)

Construct a DataTable with specified label columns. All the remaining columns are considered features.

Parameters
dataInput matrix containing all data points
y_colsColumn indices for label columns
Exceptions
DataTableError

Example Usage:

txeo::Matrix<float> data = {{1.1f, 2.2f, 3.3f, 4.4f},
{5.5f, 6.6f, 7.7f, 8.8f}};
// Columns 3 as label, 0-2 as features
DataTable<float> dt(data, {3});
assert(dt.x_dim() == 3);
assert(dt.y_dim() == 1);

◆ DataTable() [6/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  data,
std::vector< size_t y_cols 
)
inline

Definition at line 80 of file DataTable.h.

81 : DataTable{std::move(data.clone()), y_cols} {};

◆ DataTable() [7/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  data,
std::vector< size_t x_cols,
std::vector< size_t y_cols,
size_t  eval_percent 
)

Construct a DataTable with specified feature/label columns and evaluation split percentage.

Parameters
dataInput matrix containing all data points
x_colsColumn indices for feature columns
y_colsColumn indices for label columns
eval_percentPercentage of data reserved for evaluation ]0,100[
Exceptions
DataTableError

Example Usage:

txeo::Matrix<double> data(100, 5); // 100 samples, 5 columns
// 70% train, 30% eval (columns 0-2 as X, 3-4 as Y)
DataTable<double> dt(data, {0,1,2}, {3,4}, 30);
// Should have evaluation data
assert(dt.x_eval().has_value());
assert(dt.y_eval().has_value());

◆ DataTable() [8/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  data,
std::vector< size_t x_cols,
std::vector< size_t y_cols,
size_t  eval_percent 
)
inline

Definition at line 108 of file DataTable.h.

110 : DataTable{std::move(data.clone()), x_cols, y_cols, eval_percent} {};

◆ DataTable() [9/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  data,
std::vector< size_t y_cols,
size_t  eval_percent 
)

Construct a DataTable with specified label columns and evaluation split percentage. All the remaining columns are considered x features.

Parameters
dataInput matrix containing all data points
y_colsColumn indices for label columns
eval_percentPercentage of data reserved for evaluation ]0,100[
Exceptions
DataTableError

Example Usage:

txeo::Matrix<int> data = {{1, 2, 3, 4},
{5, 6, 7, 8}};
// 50% eval split, column 3 as label
DataTable<int> dt(data, {3}, 50);
// Verify split sizes
assert(dt.row_size() == 1); // 50% of 2 rows = 1
assert(dt.x_eval()->rows() == 1);

◆ DataTable() [10/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  data,
std::vector< size_t y_cols,
size_t  eval_percent 
)
inline

Definition at line 136 of file DataTable.h.

137 : DataTable{std::move(data.clone()), y_cols, eval_percent} {};

◆ DataTable() [11/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  data,
std::vector< size_t x_cols,
std::vector< size_t y_cols,
size_t  eval_percent,
size_t  eval_test 
)

Construct a DataTable with specified feature/label columns and evaluation/test split percentages.

Parameters
dataInput matrix containing all data points
x_colsColumn indices for feature columns
y_colsColumn indices for label columns
eval_percentPercentage of data reserved for evaluation ]0,100[
eval_testPercentage of data reserved for test ]0,100[
Exceptions
DataTableError

Example Usage:

txeo::Matrix<double> data(1000, 10); // 1000 samples
// Split: 70% train, 20% eval, 10% test
DataTable<double> dt(data, {0,1,2,3}, {4,5}, 20, 10);
assert(dt.x_train().rows() == 700);
assert(dt.x_eval()->rows() == 200);
assert(dt.x_test()->rows() == 100);

◆ DataTable() [12/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  data,
std::vector< size_t x_cols,
std::vector< size_t y_cols,
size_t  eval_percent,
size_t  eval_test 
)
inline

Definition at line 165 of file DataTable.h.

167 : DataTable{std::move(data.clone()), x_cols, y_cols, eval_percent, eval_test} {};

◆ DataTable() [13/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  data,
std::vector< size_t y_cols,
size_t  eval_percent,
size_t  eval_test 
)

Construct a DataTable with specified label columns and evaluation/test split percentages. All the remaining columns are considered x features.

Parameters
dataInput matrix containing all data points
y_colsColumn indices for label columns
eval_percentPercentage of data reserved for evaluation ]0,100[
eval_testPercentage of data reserved for test ]0,100[
Exceptions
DataTableError

Example Usage:

txeo::Matrix<float> data(500, 6);
// 60% train, 25% eval, 15% test
// Column 5 as label, rest as features
DataTable<float> dt(data, {5}, 25, 15);
assert(dt.x_train().rows() == 300); // 60% of 500
assert(dt.x_eval()->rows() == 125); // 25% of 500
assert(dt.x_test()->rows() == 75); // 15% of 500
const txeo::Matrix< T > * x_eval() const
Returns a pointer to evaluation input matrix.
const txeo::Matrix< T > & x_train() const
Returns training inputs matrix.
Definition DataTable.h:287
const txeo::Matrix< T > * x_test() const
Returns a pointer to test input matrix.

◆ DataTable() [14/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  data,
std::vector< size_t y_cols,
size_t  eval_percent,
size_t  eval_test 
)
inline

Definition at line 195 of file DataTable.h.

197 : DataTable<T>{std::move(data.clone()), y_cols, eval_percent, eval_test} {};
Here is the call graph for this function:

◆ DataTable() [15/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  x_train,
txeo::Matrix< T > &&  y_train,
txeo::Matrix< T > &&  x_eval,
txeo::Matrix< T > &&  y_eval,
txeo::Matrix< T > &&  x_test,
txeo::Matrix< T > &&  y_test 
)

◆ DataTable() [16/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  x_train,
const txeo::Matrix< T > &  y_train,
const txeo::Matrix< T > &  x_eval,
const txeo::Matrix< T > &  y_eval,
const txeo::Matrix< T > &  x_test,
const txeo::Matrix< T > &  y_test 
)
inline

Definition at line 225 of file DataTable.h.

228 : DataTable<T>{std::move(x_train.clone()), std::move(y_train.clone()),
229 std::move(x_eval.clone()), std::move(y_eval.clone()),
230 std::move(x_test.clone()), std::move(y_test.clone())} {};
const txeo::Matrix< T > * y_test() const
Returns a pointer to test output matrix.
const txeo::Matrix< T > & y_train() const
Returns training outputs matrix.
Definition DataTable.h:294
const txeo::Matrix< T > * y_eval() const
Returns a pointer to evaluation output matrix.
Here is the call graph for this function:

◆ DataTable() [17/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  x_train,
txeo::Matrix< T > &&  y_train,
txeo::Matrix< T > &&  x_eval,
txeo::Matrix< T > &&  y_eval 
)

◆ DataTable() [18/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  x_train,
const txeo::Matrix< T > &  y_train,
const txeo::Matrix< T > &  x_eval,
const txeo::Matrix< T > &  y_eval 
)
inline

Definition at line 254 of file DataTable.h.

256 : DataTable(std::move(x_train.clone()), std::move(y_train.clone()),
257 std::move(x_eval.clone()), std::move(y_eval.clone())) {};

◆ DataTable() [19/20]

template<typename T >
txeo::DataTable< T >::DataTable ( txeo::Matrix< T > &&  x_train,
txeo::Matrix< T > &&  y_train 
)

◆ DataTable() [20/20]

template<typename T >
txeo::DataTable< T >::DataTable ( const txeo::Matrix< T > &  x_train,
const txeo::Matrix< T > &  y_train 
)
inline

Definition at line 279 of file DataTable.h.

280 : DataTable{std::move(x_train.clone()), std::move(y_train.clone())} {};

Member Function Documentation

◆ clone()

template<typename T >
DataTable< T > txeo::DataTable< T >::clone ( ) const
Examples
/opt/build/repo/include/txeo/DataTable.h.
Here is the caller graph for this function:

◆ has_eval()

template<typename T >
bool txeo::DataTable< T >::has_eval ( ) const
inline
Examples
/opt/build/repo/include/txeo/DataTable.h.

Definition at line 345 of file DataTable.h.

345{ return _has_eval; }

◆ has_test()

template<typename T >
bool txeo::DataTable< T >::has_test ( ) const
inline
Examples
/opt/build/repo/include/txeo/DataTable.h.

Definition at line 347 of file DataTable.h.

347{ return _has_test; }

◆ operator=() [1/2]

◆ operator=() [2/2]

template<typename T >
DataTable & txeo::DataTable< T >::operator= ( DataTable< T > &&  )
default

◆ row_size()

template<typename T >
size_t txeo::DataTable< T >::row_size ( ) const

Returns the number of training rows.

Returns
Number of training samples.
Examples
/opt/build/repo/include/txeo/DataTable.h.

◆ x_dim()

template<typename T >
size_t txeo::DataTable< T >::x_dim ( ) const

Returns the number of input columns.

Returns
Feature dimension.
Examples
/opt/build/repo/include/txeo/DataTable.h.

◆ x_eval()

template<typename T >
const txeo::Matrix< T > * txeo::DataTable< T >::x_eval ( ) const

Returns a pointer to evaluation input matrix.

Returns
Matrix of shape [rows, x_dim]. A nullptr means evaluation was not specified.
Examples
/opt/build/repo/include/txeo/DataTable.h.
Here is the caller graph for this function:

◆ x_test()

template<typename T >
const txeo::Matrix< T > * txeo::DataTable< T >::x_test ( ) const

Returns a pointer to test input matrix.

Returns
Matrix of shape [rows, x_dim]. A nullptr means test data was not specified.
Examples
/opt/build/repo/include/txeo/DataTable.h.
Here is the caller graph for this function:

◆ x_train()

template<typename T >
const txeo::Matrix< T > & txeo::DataTable< T >::x_train ( ) const
inline

Returns training inputs matrix.

Returns
Matrix of shape [rows, x_dim]
Examples
/opt/build/repo/include/txeo/DataTable.h.

Definition at line 287 of file DataTable.h.

287{ return _x_train; }
Here is the caller graph for this function:

◆ y_dim()

template<typename T >
size_t txeo::DataTable< T >::y_dim ( ) const

Returns the number of output columns.

Returns
Label dimension.
Examples
/opt/build/repo/include/txeo/DataTable.h.

◆ y_eval()

template<typename T >
const txeo::Matrix< T > * txeo::DataTable< T >::y_eval ( ) const

Returns a pointer to evaluation output matrix.

Returns
Matrix of shape [rows, y_dim]. A nullptr means evaluation data was not specified.
Examples
/opt/build/repo/include/txeo/DataTable.h.
Here is the caller graph for this function:

◆ y_test()

template<typename T >
const txeo::Matrix< T > * txeo::DataTable< T >::y_test ( ) const

Returns a pointer to test output matrix.

Returns
Matrix of shape [rows, y_dim]. A nullptr means test data was not specified.
Examples
/opt/build/repo/include/txeo/DataTable.h.
Here is the caller graph for this function:

◆ y_train()

template<typename T >
const txeo::Matrix< T > & txeo::DataTable< T >::y_train ( ) const
inline

Returns training outputs matrix.

Returns
Matrix of shape [rows, y_dim]
Examples
/opt/build/repo/include/txeo/DataTable.h.

Definition at line 294 of file DataTable.h.

294{ return _y_train; }
Here is the caller graph for this function:

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