9 #include <core/export.hpp> 10 #include <model_server/lib/extensions/ml_model.hpp> 11 #include <core/data/sframe/gl_sframe.hpp> 12 #include <model_server/lib/toolkit_class_macros.hpp> 17 class EXPORT sparse_nn :
public ml_model_base {
19 static constexpr
size_t SPARSE_NN_VERSION = 0;
21 typedef uint128_t hash_type;
25 void train(
const gl_sframe& data,
const std::string& id_column);
31 void save_impl(oarchive& oarc)
const override;
32 void load_version(iarchive& iarc,
size_t version)
override;
42 size_t m_num_columns = 0;
43 std::vector<flexible_type> m_ids;
55 std::vector<hash_type> m_hashes;
57 std::vector<
std::pair<uint32_t, uint32_t> > m_access_bounds;
58 std::vector<uint32_t> m_hit_indices;
60 inline hash_type feature_hash(const
std::
string& column,
61 const flexible_type& feature)
const {
#define BEGIN_CLASS_MEMBER_REGISTRATION(python_facing_classname)
#define REGISTER_CLASS_MEMBER_FUNCTION(function,...)
static uint128_t hash128(const char *s, size_t len)
#define IMPORT_BASE_CLASS_REGISTRATION(base_class)
static uint128_t hash128_combine(uint128_t h1, uint128_t h2)
#define END_CLASS_MEMBER_REGISTRATION
std::vector< std::pair< flexible_type, flexible_type > > flex_dict