6 #ifndef TURI_REGR_LINEAR_REGRESSION_H_ 7 #define TURI_REGR_LINEAR_REGRESSION_H_ 10 #include <ml/ml_data/metadata.hpp> 14 #include <toolkits/supervised_learning/supervised_learning.hpp> 15 #include <toolkits/coreml_export/mlmodel_wrapper.hpp> 18 #include <ml/optimization/optimization_interface.hpp> 20 #include <core/export.hpp> 23 namespace supervised {
25 class linear_regression_opt_interface;
42 std::shared_ptr<linear_regression_opt_interface> lr_interface;
46 static constexpr
size_t LINEAR_REGRESSION_MODEL_VERSION = 4;
47 Eigen::Matrix<double, Eigen::Dynamic,1>
coefs;
48 Eigen::Matrix<double, Eigen::Dynamic,1> std_err;
62 void model_specific_init(
const ml_data& data,
const ml_data& valid_data)
override;
69 void init_options(
const std::map<std::string,flexible_type>& _options)
override;
74 size_t get_version()
const override;
81 void train()
override;
86 void set_coefs(
const DenseVector& _coefs)
override;
108 const DenseVector& x,
109 const prediction_type_enum& output_type=prediction_type_enum::NA)
override;
121 const SparseVector& x,
122 const prediction_type_enum& output_type=prediction_type_enum::NA)
override;
128 _coefs.resize(coefs.size());
132 std::shared_ptr<coreml::MLModelWrapper> export_to_coreml()
override;
#define BEGIN_CLASS_MEMBER_REGISTRATION(python_facing_classname)
The serialization input archive object which, provided with a reference to an istream, will read from the istream, providing deserialization capabilities.
#define IMPORT_BASE_CLASS_REGISTRATION(base_class)
#define END_CLASS_MEMBER_REGISTRATION
bool is_classifier() const override
The serialization output archive object which, provided with a reference to an ostream, will write to the ostream, providing serialization capabilities.
void get_coefficients(DenseVector &_coefs) const
Eigen::Matrix< double, Eigen::Dynamic, 1 > coefs