mlpack
Public Types | Public Member Functions | Static Public Attributes | List of all members
mlpack::data::MissingPolicy Class Reference

MissingPolicy is used as a helper class for DatasetMapper. More...

#include <missing_policy.hpp>

Public Types

using MappedType = double
 

Public Member Functions

 MissingPolicy (std::set< std::string > missingSet)
 Create the MissingPolicy object with the given missingSet. More...
 
template<typename T >
void MapFirstPass (const std::string &, const size_t)
 There is nothing for us to do here, but this is required by the MapPolicy type.
 
template<typename MapType , typename T >
MapString (const std::string &string, const size_t dimension, MapType &maps, std::vector< Datatype > &)
 Given the string and the dimension to which it belongs by the user, and the maps and types given by the DatasetMapper class, returns its numeric mapping. More...
 

Static Public Attributes

static const bool NeedsFirstPass = false
 This doesn't need a first pass over the data to set up.
 

Detailed Description

MissingPolicy is used as a helper class for DatasetMapper.

It tells how the strings should be mapped. Purpose of this policy is to map all user-defined missing variables into maps so that users can decide what to do with the corrupted data. User-defined missing variables are given by the missingSet. Note that MissingPolicy does not change type of features.

Constructor & Destructor Documentation

◆ MissingPolicy()

mlpack::data::MissingPolicy::MissingPolicy ( std::set< std::string >  missingSet)
inlineexplicit

Create the MissingPolicy object with the given missingSet.

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

Parameters
missingSetSet of strings that should be mapped.

Member Function Documentation

◆ MapString()

template<typename MapType , typename T >
T mlpack::data::MissingPolicy::MapString ( const std::string &  string,
const size_t  dimension,
MapType &  maps,
std::vector< Datatype > &   
)
inline

Given the string and the dimension to which it belongs by the user, and the maps and types given by the DatasetMapper class, returns its numeric mapping.

If no mapping yet exists and the string is included in the missingSet, the string is added to the list of mappings for the given dimension. This function is used as a helper function for DatasetMapper class.

Template Parameters
MapTypeType of unordered_map that contains mapped value pairs
Parameters
stringString to find/create mapping for.
dimensionIndex of the dimension of the string.
mapsUnordered map given by the DatasetMapper.
*(types) Vector containing the type information about each dimensions.

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