6 #ifndef TURI_TEXT_CGS_H_ 7 #define TURI_TEXT_CGS_H_ 10 #include <core/export.hpp> 11 #include <toolkits/text/topic_model.hpp> 12 #include <toolkits/util/spmat.hpp> 23 size_t random_categorical(std::vector<double>& logprobs);
25 class EXPORT cgs_topic_model :
public topic_model {
29 static constexpr
size_t CGS_TOPIC_MODEL_VERSION = 1;
39 topic_model* topic_model_clone()
override;
48 void init_options(
const std::map<std::string,flexible_type>& _opts)
override;
50 inline size_t get_version()
const override {
51 return CGS_TOPIC_MODEL_VERSION;
91 void train(std::shared_ptr<sarray<flexible_type>> data,
bool verbose)
override;
93 std::shared_ptr<sarray<std::vector<size_t>>>
94 forward_sample(
const v2::ml_data& d,
95 count_vector_type& topic_counts,
96 count_matrix_type& doc_topic_counts);
98 std::map<std::string, size_t>
99 sample_counts(
const v2::ml_data& d,
100 count_vector_type& topic_counts,
101 count_matrix_type& doc_topic_counts,
102 std::shared_ptr<sarray<std::vector<size_t>>>& assignments);
#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.
#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.