9 #ifndef META_NEAREST_CENTROID_H_
10 #define META_NEAREST_CENTROID_H_
35 const static std::string
id;
41 std::shared_ptr<index::forward_index> f_idx);
47 void train(
const std::vector<doc_id>& docs)
override;
55 class_label
classify(doc_id d_id)
override;
60 void reset()
override;
68 double cosine_sim(
const std::vector<std::pair<term_id, double>>& doc,
69 const std::unordered_map<term_id, double>& centroid);
72 std::shared_ptr<index::inverted_index>
inv_idx_;
75 std::unordered_map<class_label, std::unordered_map<term_id, double>>
85 using std::runtime_error::runtime_error;
95 const cpptoml::table&, std::shared_ptr<index::forward_index>,
96 std::shared_ptr<index::inverted_index>);