mlpack  2.0.1
Public Member Functions | Private Attributes | List of all members
mlpack::data::DatasetInfo Class Reference

Auxiliary information for a dataset, including mappings to/from strings and the datatype of each dimension. More...

Public Member Functions

 DatasetInfo (const size_t dimensionality=0)
 Create the DatasetInfo object with the given dimensionality. More...
 
size_t Dimensionality () const
 
size_t MapString (const std::string &string, const size_t dimension)
 Given the string and the dimension to which it belongs, return its numeric mapping. More...
 
size_t NumMappings (const size_t dimension) const
 
template<typename Archive >
void Serialize (Archive &ar, const unsigned int)
 
Datatype Type (const size_t dimension) const
 
DatatypeType (const size_t dimension)
 
const std::string & UnmapString (const size_t value, const size_t dimension)
 

Private Attributes

std::unordered_map< size_t, std::pair< boost::bimap< std::string, size_t >, size_t > > maps
 
std::vector< Datatypetypes
 

Detailed Description

Auxiliary information for a dataset, including mappings to/from strings and the datatype of each dimension.

DatasetInfo objects are optionally produced by data::Load(), and store the type of each dimension (Datatype::NUMERIC or Datatype::CATEGORICAL) as well as mappings from strings to unsigned integers and vice versa.

Definition at line 45 of file dataset_info.hpp.

Constructor & Destructor Documentation

mlpack::data::DatasetInfo::DatasetInfo ( const size_t  dimensionality = 0)

Create the DatasetInfo object with the given dimensionality.

Note that the dimensionality cannot be changed later; you will have to create a new DatasetInfo object.

Member Function Documentation

size_t mlpack::data::DatasetInfo::Dimensionality ( ) const
size_t mlpack::data::DatasetInfo::MapString ( const std::string &  string,
const size_t  dimension 
)

Given the string and the dimension to which it belongs, return its numeric mapping.

If no mapping yet exists, the string is added to the list of mappings for the given dimension. The dimension parameter refers to the index of the dimension of the string (i.e. the row in the dataset).

Parameters
stringString to find/create mapping for.
dimensionIndex of the dimension of the string.
size_t mlpack::data::DatasetInfo::NumMappings ( const size_t  dimension) const
template<typename Archive >
void mlpack::data::DatasetInfo::Serialize ( Archive &  ar,
const unsigned  int 
)
inline

Definition at line 76 of file dataset_info.hpp.

References mlpack::data::CreateNVP(), maps, and types.

Datatype mlpack::data::DatasetInfo::Type ( const size_t  dimension) const
Datatype& mlpack::data::DatasetInfo::Type ( const size_t  dimension)
const std::string& mlpack::data::DatasetInfo::UnmapString ( const size_t  value,
const size_t  dimension 
)

Member Data Documentation

std::unordered_map<size_t, std::pair<boost::bimap<std::string, size_t>, size_t> > mlpack::data::DatasetInfo::maps
private

Definition at line 87 of file dataset_info.hpp.

Referenced by Serialize().

std::vector<Datatype> mlpack::data::DatasetInfo::types
private

Definition at line 83 of file dataset_info.hpp.

Referenced by Serialize().


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