9 #include <core/export.hpp> 11 #include <unordered_map> 13 #include <model_server/lib/toolkit_class_macros.hpp> 14 #include <toolkits/feature_engineering/transformer_base.hpp> 15 #include <toolkits/feature_engineering/topk_indexer.hpp> 19 namespace feature_engineering {
21 typedef std::unordered_map<std::string, std::shared_ptr<topk_indexer>> indexer_type;
23 class EXPORT tfidf :
public transformer_base {
25 static constexpr
size_t TFIDF_VERSION = 0;
26 indexer_type index_map;
28 std::map<std::string, flex_type_enum> feature_types;
29 flexible_type feature_columns;
39 virtual inline ~tfidf() {}
48 void init_options(
const std::map<std::string, flexible_type>&_options)
override;
53 size_t get_version()
const override;
69 void init_transformer(
const std::map<std::string,
70 flexible_type>& _options)
override;
77 void fit(gl_sframe data)
override;
89 gl_sframe
transform(gl_sframe data)
override;
98 gl_sframe fit_transform(gl_sframe data) {
107 const indexer_type& get_indexer()
const {
122 tfidf::get_default_options);
124 tfidf::get_value_from_state,
#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
#define REGISTER_NAMED_CLASS_MEMBER_FUNCTION(name, function,...)
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
void transform(S &&input, T &&output, TransformFn transformfn, std::set< size_t > constraint_segments=std::set< size_t >())