6 #ifndef TURI_FP_GROWTH_H 7 #define TURI_FP_GROWTH_H 14 #include <core/export.hpp> 15 #include <core/util/dense_bitset.hpp> 17 #include <core/data/sframe/gl_sframe.hpp> 18 #include <core/data/sframe/gl_sarray.hpp> 19 #include <model_server/lib/toolkit_class_macros.hpp> 20 #include <model_server/lib/extensions/ml_model.hpp> 22 #include <toolkits/pattern_mining/fp_tree.hpp> 23 #include <toolkits/pattern_mining/fp_results_tree.hpp> 24 #include <toolkits/feature_engineering/topk_indexer.hpp> 27 namespace pattern_mining {
38 static constexpr
size_t FP_GROWTH_VERSION = 0;
42 std::vector<dense_bitset> closed_bitsets;
44 std::vector<std::string> features;
46 std::shared_ptr<topk_indexer> indexer;
59 const std::string& item,
60 const std::vector<std::string>& features)
const;
67 this->features.resize(_features.size());
68 for (
size_t i = 0; i < _features.size(); ++i) {
69 this->features[i] = _features[i];
71 add_or_update_state({{
"features",
to_variant(this->features)}});
72 add_or_update_state({{
"num_features",
to_variant(_features.size())}});
81 this->item.assign(_item);
82 add_or_update_state({{
"item",
to_variant(this->item)}});
114 const std::string& score_function =
"confidence",
115 const size_t& k = 5)
const;
120 size_t get_version()
const override;
126 void save_impl(
oarchive& oarc)
const override;
132 void load_version(
iarchive& iarc,
size_t version)
override;
141 void init_options(
const std::map<std::string,flexible_type>& _options)
override;
157 "data",
"score_function",
"k");
177 EXPORT std::shared_ptr<fp_growth> _pattern_mining_create(
180 std::vector<std::string> features,
203 const size_t& min_support);
206 const size_t& min_support);
227 size_t& min_support,
const size_t& top_k = TOP_K_MAX, \
228 const size_t& min_length = 1);
#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.
void init_options(const std::map< std::string, flexible_type > &_options) override
gl_sframe predict_topk(const gl_sframe &data, const std::string &score_function="confidence", const size_t &k=5) const
const std::map< std::string, flexible_type > & get_current_options() const
#define END_CLASS_MEMBER_REGISTRATION
const variant_type & get_value_from_state(std::string key)
std::vector< std::string > list_fields()
#define REGISTER_NAMED_CLASS_MEMBER_FUNCTION(name, function,...)
variant_type to_variant(const T &f)
gl_sframe get_frequent_patterns() const
std::map< std::string, flexible_type > get_default_options() const
gl_sframe extract_features(const gl_sframe &data) const
void set_item(const std::string &_item)
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
void set_features(const std::vector< std::string > &_features)