v2.0.0
Loading...
Searching...
No Matches
ml_linear_model.h
Go to the documentation of this file.
1//=============================================================================================================
34
35#ifndef ML_LINEAR_MODEL_H
36#define ML_LINEAR_MODEL_H
37
38//=============================================================================================================
39// INCLUDES
40//=============================================================================================================
41
42#include "ml_global.h"
43#include "ml_model.h"
44
45//=============================================================================================================
46// EIGEN INCLUDES
47//=============================================================================================================
48
49#include <Eigen/Core>
50
51//=============================================================================================================
52// DEFINE NAMESPACE MLLIB
53//=============================================================================================================
54
55namespace MLLIB{
56
57//=============================================================================================================
62{
63public:
64 //=========================================================================================================
71 MlLinearModel(MlTaskType type = MlTaskType::Regression, double regularization = 1.0);
72
73 //=========================================================================================================
74 MlTensor predict(const MlTensor& input) const override;
75 bool save(const QString& path) const override;
76 bool load(const QString& path) override;
77 QString modelType() const override;
78 MlTaskType taskType() const override;
79
80 //=========================================================================================================
84 const Eigen::MatrixXf& weights() const;
85
86 //=========================================================================================================
90 const Eigen::VectorXf& bias() const;
91
92private:
93 MlTaskType m_taskType;
94 double m_regularization;
95 Eigen::MatrixXf m_weights;
96 Eigen::VectorXf m_bias;
97 bool m_trained = false;
98};
99
100} // namespace MLLIB
101
102#endif // ML_LINEAR_MODEL_H
MlModel pure-abstract base class declaration.
ml library export/import macros.
#define MLSHARED_EXPORT
Definition ml_global.h:55
Machine learning (models, pipelines, ONNX Runtime integration).
MlTaskType
Definition ml_types.h:60
MlTensor predict(const MlTensor &input) const override
bool save(const QString &path) const override
MlLinearModel(MlTaskType type=MlTaskType::Regression, double regularization=1.0)
bool load(const QString &path) override
const Eigen::MatrixXf & weights() const
MlTaskType taskType() const override
const Eigen::VectorXf & bias() const
QString modelType() const override
Abstract interface for all ML models.
Definition ml_model.h:64
N-dimensional tensor with contiguous row-major (C-order) float32 storage.
Definition ml_tensor.h:79