v2.0.0
Loading...
Searching...
No Matches
MLLIB::MlLinearModel Class Reference

Ridge regression / logistic regression built-in model. More...

#include <ml_linear_model.h>

Public Member Functions

 MlLinearModel (MlTaskType type=MlTaskType::Regression, double regularization=1.0)
MlTensor predict (const MlTensor &input) const override
bool save (const QString &path) const override
bool load (const QString &path) override
QString modelType () const override
MlTaskType taskType () const override
const Eigen::MatrixXf & weights () const
const Eigen::VectorXf & bias () const
Public Member Functions inherited from MLLIB::MlModel
virtual ~MlModel ()=default

Additional Inherited Members

Public Types inherited from MLLIB::MlModel
typedef QSharedPointer< MlModelSPtr

Detailed Description

Ridge regression / logistic regression built-in model.

Definition at line 61 of file ml_linear_model.h.

Inheritance diagram for MLLIB::MlLinearModel:
Inheritance graph

Constructor & Destructor Documentation

◆ MlLinearModel()

MlLinearModel::MlLinearModel ( MlTaskType type = MlTaskType::Regression,
double regularization = 1.0 )

Construct a linear model.

Parameters
[in]typeTask type (Regression or Classification).
[in]regularizationRidge / L2 regularization strength (lambda).

Definition at line 75 of file ml_linear_model.cpp.

Member Function Documentation

◆ bias()

const VectorXf & MlLinearModel::bias ( ) const
Returns
Const reference to the bias vector (n_outputs).

Definition at line 222 of file ml_linear_model.cpp.

◆ load()

bool MlLinearModel::load ( const QString & path)
overridevirtual

Load a model from disk.

Parameters
[in]pathFile path.
Returns
True if successful.

Implements MLLIB::MlModel.

Definition at line 151 of file ml_linear_model.cpp.

◆ modelType()

QString MlLinearModel::modelType ( ) const
overridevirtual
Returns
Human-readable model type name.

Implements MLLIB::MlModel.

Definition at line 201 of file ml_linear_model.cpp.

◆ predict()

MlTensor MlLinearModel::predict ( const MlTensor & input) const
overridevirtual

Run inference on the given input tensor.

Parameters
[in]inputThe input data.
Returns
The prediction result.

Implements MLLIB::MlModel.

Definition at line 83 of file ml_linear_model.cpp.

◆ save()

bool MlLinearModel::save ( const QString & path) const
overridevirtual

Serialise the model to disk.

Parameters
[in]pathFile path.
Returns
True if successful.

Implements MLLIB::MlModel.

Definition at line 102 of file ml_linear_model.cpp.

◆ taskType()

MlTaskType MlLinearModel::taskType ( ) const
overridevirtual
Returns
The task type this model is configured for.

Implements MLLIB::MlModel.

Definition at line 208 of file ml_linear_model.cpp.

◆ weights()

const MatrixXf & MlLinearModel::weights ( ) const
Returns
Const reference to the weight matrix (n_features x n_outputs).

Definition at line 215 of file ml_linear_model.cpp.


The documentation for this class was generated from the following files: