6 #ifndef TURI_TOPK_STATISTICS_TRACKER_H_ 7 #define TURI_TOPK_STATISTICS_TRACKER_H_ 9 #include <core/data/flexible_type/flexible_type.hpp> 10 #include <core/util/hash_value.hpp> 11 #include <core/logging/assertions.hpp> 12 #include <core/util/bitops.hpp> 13 #include <core/storage/serialization/serialization_includes.hpp> 14 #include <core/generics/hopscotch_map.hpp> 15 #include <core/parallel/pthread_tools.hpp> 16 #include <core/export.hpp> 83 column_name(_column_name) {
138 void finalize(
size_t num_examples);
155 return index_lookup.size();
162 inline std::vector<flexible_type>
get_keys()
const {
169 size_t get_version()
const;
184 std::string column_name =
"";
187 struct threadlocal_accumulator{
188 std::vector<hopscotch_map<hash_value, size_t>> count;
189 std::vector<hopscotch_map<hash_value, flex_float>> mean;
190 std::vector<hopscotch_map<hash_value, size_t>> missing;
191 std::vector<hopscotch_map<hash_value, flexible_type>> key_index;
192 } threadlocal_accumulator;
194 std::vector<size_t> counts;
195 std::vector<flex_float> means;
196 std::vector<size_t> missing;
197 std::vector<flexible_type>
keys;
222 size_t version = m->get_version();
227 } END_OUT_OF_PLACE_SAVE()
233 arc >> is_not_nullptr;
242 m->load_version(arc, version);
245 m = std::shared_ptr<statistics_tracker>(
nullptr);
247 } END_OUT_OF_PLACE_LOAD()
#define BEGIN_OUT_OF_PLACE_LOAD(arc, tname, tval)
Macro to make it easy to define out-of-place loads.
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
std::set< Key > keys(const std::map< Key, T > &map)
statistics_tracker(const std::string _column_name="")
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
#define BEGIN_OUT_OF_PLACE_SAVE(arc, tname, tval)
Macro to make it easy to define out-of-place saves.
std::vector< flexible_type > get_keys() const