12 #ifndef MLPACK_CORE_DATA_MAP_POLICIES_MISSING_POLICY_HPP
13 #define MLPACK_CORE_DATA_MAP_POLICIES_MISSING_POLICY_HPP
16 #include <unordered_map>
49 missingSet(
std::move(missingSet))
81 template<
typename MapType,
typename T>
83 const size_t dimension,
85 std::vector<Datatype>& )
87 static_assert(std::numeric_limits<T>::has_quiet_NaN ==
true,
88 "Cannot use MissingPolicy with types where has_quiet_NaN() is false!");
91 std::stringstream token;
96 MappedType value = std::numeric_limits<MappedType>::quiet_NaN();
100 std::numeric_limits<MappedType>::max(),
MappedType(0));
104 if (token.fail() || !token.eof() ||
105 missingSet.find(
string) != std::end(missingSet))
109 if (maps.count(dimension) == 0 ||
110 maps[dimension].first.count(
string) == 0)
113 typedef std::pair<std::string, MappedType> PairType;
114 maps[dimension].first.insert(PairType(
string, value));
117 if (maps[dimension].second.count(mapValue) == 0)
120 maps[dimension].second.insert(std::make_pair(mapValue,
121 std::vector<std::string>()));
123 maps[dimension].second[mapValue].push_back(
string);
139 std::set<std::string> missingSet;