table of contents
other versions
- jessie 1.0.10-1
mlpack::data(3) | MLPACK | mlpack::data(3) |
NAME¶
mlpack::data - Functions to load and save matrices.SYNOPSIS¶
Functions¶
template<typename eT > bool Load (const std::string &filename, arma::Mat< eT > &matrix, bool fatal=false, bool transpose=true)
Detailed Description¶
Functions to load and save matrices.Function Documentation¶
template<typename eT > bool mlpack::data::Load (const std::string &filename, arma::Mat< eT > &matrix, boolfatal = false, booltranspose = true)¶
Loads a matrix from file, guessing the filetype from the extension. This will transpose the matrix at load time. If the filetype cannot be determined, an error will be given. The supported types of files are the same as found in Armadillo:- •
- CSV (csv_ascii), denoted by .csv, or optionally .txt
- •
- ASCII (raw_ascii), denoted by .txt
- •
- Armadillo ASCII (arma_ascii), also denoted by .txt
- •
- PGM (pgm_binary), denoted by .pgm
- •
- PPM (ppm_binary), denoted by .ppm
- •
- Raw binary (raw_binary), denoted by .bin
- •
- Armadillo binary (arma_binary), denoted by .bin
- •
- HDF5, denoted by .hdf, .hdf5, .h5, or .he5
filename Name of file to load.
matrix Matrix to load contents of file into.
fatal If an error should be reported as fatal (default false).
transpose If true, transpose the matrix after loading.
Returns:
Boolean value indicating success or failure of
load.
template<typename eT > void mlpack::data::NormalizeLabels (const arma::Col< eT > &labelsIn, arma::Col< size_t > &labels, arma::Col< eT > &mapping)¶
Given a set of labels of a particular datatype, convert them to unsigned labels in the range [0, n) where n is the number of different labels. Also, a reverse mapping from the new label to the old value is stored in the 'mapping' vector. Parameters:labelsIn Input labels of arbitrary datatype.
labels Vector that unsigned labels will be stored in.
mapping Reverse mapping to convert new labels back to old labels.
template<typename eT > void mlpack::data::RevertLabels (const arma::Col< size_t > &labels, const arma::Col< eT > &mapping, arma::Col< eT > &labelsOut)¶
Given a set of labels that have been mapped to the range [0, n), map them back to the original labels given by the 'mapping' vector. Parameters:labels Set of normalized labels to convert.
mapping Mapping to use to convert labels.
labelsOut Vector to store new labels in.
template<typename eT > bool mlpack::data::Save (const std::string &filename, const arma::Mat< eT > &matrix, boolfatal = false, booltranspose = true)¶
Saves a matrix to file, guessing the filetype from the extension. This will transpose the matrix at save time. If the filetype cannot be determined, an error will be given. The supported types of files are the same as found in Armadillo:- •
- CSV (csv_ascii), denoted by .csv, or optionally .txt
- •
- ASCII (raw_ascii), denoted by .txt
- •
- Armadillo ASCII (arma_ascii), also denoted by .txt
- •
- PGM (pgm_binary), denoted by .pgm
- •
- PPM (ppm_binary), denoted by .ppm
- •
- Raw binary (raw_binary), denoted by .bin
- •
- Armadillo binary (arma_binary), denoted by .bin
- •
- HDF5 (hdf5_binary), denoted by .hdf5, .hdf, .h5, or .he5
filename Name of file to save to.
matrix Matrix to save into file.
fatal If an error should be reported as fatal (default false).
transpose If true, transpose the matrix before saving.
Returns:
Boolean value indicating success or failure of
save.
Author¶
Generated automatically by Doxygen for MLPACK from the source code.Tue Sep 9 2014 | Version 1.0.10 |