6 #ifndef TURI_TEXT_ALIAS_H_ 7 #define TURI_TEXT_ALIAS_H_ 10 #include <core/random/alias.hpp> 11 #include <toolkits/util/spmat.hpp> 12 #include <toolkits/text/topic_model.hpp> 13 #include <core/export.hpp> 14 #include <toolkits/text/topic_model.hpp> 74 static constexpr
size_t ALIAS_TOPIC_MODEL_VERSION = 1;
93 void init_options(
const std::map<std::string,flexible_type>& _opts)
override;
96 return ALIAS_TOPIC_MODEL_VERSION;
125 std::shared_ptr<sarray<std::vector<size_t>>>
126 forward_sample(v2::ml_data d);
134 void cache_word_pmf_and_samples(
size_t w);
140 std::map<std::string, size_t> sample_counts(v2::ml_data d,
size_t num_blocks);
146 void sample_block(
const v2::ml_data& d,
147 std::vector<std::vector<size_t>>& doc_assignments);
157 size_t sample_topic(
size_t d,
size_t w,
size_t s,
158 std::vector<double>& pd);
161 std::shared_ptr<sarray<std::vector<size_t>>> assignments;
163 spmat doc_topic_counts;
164 count_vector_type topic_counts;
167 atomic<size_t> token_count;
172 std::vector<random::alias_sampler> word_samplers;
173 std::vector<std::vector<size_t>> word_samples;
176 size_t TARGET_BLOCK_NUM_ELEMENTS = 1000000000/16;
size_t get_version() const override
#define BEGIN_CLASS_MEMBER_REGISTRATION(python_facing_classname)
#define REGISTER_CLASS_MEMBER_FUNCTION(function,...)
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
std::vector< std::string > list_fields()
#define END_CLASS_MEMBER_REGISTRATION
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.