12 #ifndef MLPACK_CORE_DATA_MAP_POLICIES_MISSING_POLICY_HPP
13 #define MLPACK_CORE_DATA_MAP_POLICIES_MISSING_POLICY_HPP
16 #include <unordered_map>
50 missingSet(
std::move(missingSet))
83 template<
typename MapType,
typename T>
85 const size_t dimension,
87 std::vector<Datatype>& )
89 static_assert(std::numeric_limits<T>::has_quiet_NaN ==
true,
90 "Cannot use MissingPolicy with types where has_quiet_NaN() is false!");
93 std::stringstream token;
98 MappedType value = std::numeric_limits<MappedType>::quiet_NaN();
102 std::numeric_limits<MappedType>::max(),
MappedType(0));
106 if (token.fail() || !token.eof() ||
107 missingSet.find(
string) != std::end(missingSet))
111 if (maps.count(dimension) == 0 ||
112 maps[dimension].first.count(
string) == 0)
115 typedef std::pair<std::string, MappedType> PairType;
116 maps[dimension].first.insert(PairType(
string, value));
119 if (maps[dimension].second.count(mapValue) == 0)
122 maps[dimension].second.insert(std::make_pair(mapValue,
123 std::vector<std::string>()));
125 maps[dimension].second[mapValue].push_back(
string);
141 std::set<std::string> missingSet;