LoadCSV Class Reference

Load the csv file.This class use boost::spirit to implement the parser, please refer to following link http://theboostcpplibraries.com/boost.spirit for quick review. More...

Public Member Functions

 LoadCSV (const std::string &file)
 Construct the LoadCSV object on the given file. More...

 
template
<
typename
T
,
typename
MapPolicy
>
void GetMatrixSize (size_t &rows, size_t &cols, DatasetMapper< MapPolicy > &info)
 Peek at the file to determine the number of rows and columns in the matrix, assuming a non-transposed matrix. More...

 
template
<
typename
T
,
typename
MapPolicy
>
void GetTransposeMatrixSize (size_t &rows, size_t &cols, DatasetMapper< MapPolicy > &info)
 Peek at the file to determine the number of rows and columns in the matrix, assuming a transposed matrix. More...

 
template
<
typename
T
,
typename
PolicyType
>
void Load (arma::Mat< T > &inout, DatasetMapper< PolicyType > &infoSet, const bool transpose=true)
 Load the file into the given matrix with the given DatasetMapper object. More...

 

Detailed Description

Load the csv file.This class use boost::spirit to implement the parser, please refer to following link http://theboostcpplibraries.com/boost.spirit for quick review.

Definition at line 36 of file load_csv.hpp.

Constructor & Destructor Documentation

◆ LoadCSV()

LoadCSV ( const std::string &  file)

Construct the LoadCSV object on the given file.

This will construct the rules necessary for loading and attempt to open the file.

Member Function Documentation

◆ GetMatrixSize()

void GetMatrixSize ( size_t &  rows,
size_t &  cols,
DatasetMapper< MapPolicy > &  info 
)
inline

Peek at the file to determine the number of rows and columns in the matrix, assuming a non-transposed matrix.

This will also take a first pass over the data for DatasetMapper, if MapPolicy::NeedsFirstPass is true. The info object will be re-initialized with the correct dimensionality.

Parameters
rowsVariable to be filled with the number of rows.
colsVariable to be filled with the number of columns.
infoDatasetMapper object to use for first pass.

Definition at line 78 of file load_csv.hpp.

References DatasetMapper< PolicyType, InputType >::Dimensionality(), and DatasetMapper< PolicyType, InputType >::SetDimensionality().

◆ GetTransposeMatrixSize()

void GetTransposeMatrixSize ( size_t &  rows,
size_t &  cols,
DatasetMapper< MapPolicy > &  info 
)
inline

Peek at the file to determine the number of rows and columns in the matrix, assuming a transposed matrix.

This will also take a first pass over the data for DatasetMapper, if MapPolicy::NeedsFirstPass is true. The info object will be re-initialized with the correct dimensionality.

Parameters
rowsVariable to be filled with the number of rows.
colsVariable to be filled with the number of columns.
infoDatasetMapper object to use for first pass.

Definition at line 164 of file load_csv.hpp.

References DatasetMapper< PolicyType, InputType >::Dimensionality(), and DatasetMapper< PolicyType, InputType >::SetDimensionality().

◆ Load()

void Load ( arma::Mat< T > &  inout,
DatasetMapper< PolicyType > &  infoSet,
const bool  transpose = true 
)
inline

Load the file into the given matrix with the given DatasetMapper object.

Throws exceptions on errors.

Parameters
inoutMatrix to load into.
infoSetDatasetMapper to use while loading.
transposeIf true, the matrix should be transposed on loading (default).

Definition at line 55 of file load_csv.hpp.


The documentation for this class was generated from the following file:
  • /home/ryan/src/mlpack.org/_src/mlpack-git/src/mlpack/core/data/load_csv.hpp