Cpp ML Library  1.0.0
A library of Machine Learning Algorithmns seen from the Udemy course Machine Learning A to Z.
Public Member Functions | List of all members
MultilinearRegression Class Reference

A class that implements Multilinear Regression for predicting values based on multiple features. More...

#include <MultiLinearRegression.hpp>

Public Member Functions

 MultilinearRegression (double learningRate=0.01, int iterations=1000, double regularizationParameter=0.0)
 Constructs the MultilinearRegression model with the given learning rate and number of iterations. More...
 
void train (const std::vector< std::vector< double >> &features, const std::vector< double > &target)
 Trains the Multilinear Regression model on the provided data. More...
 
double predict (const std::vector< double > &features) const
 Predicts the output for a given set of features. More...
 
std::vector< double > getWeights () const
 Gets the current weights of the model. More...
 
double getBias () const
 Gets the current bias of the model. More...
 

Detailed Description

A class that implements Multilinear Regression for predicting values based on multiple features.

Constructor & Destructor Documentation

◆ MultilinearRegression()

MultilinearRegression::MultilinearRegression ( double  learningRate = 0.01,
int  iterations = 1000,
double  regularizationParameter = 0.0 
)
inline

Constructs the MultilinearRegression model with the given learning rate and number of iterations.

Parameters
learningRateThe rate at which the model learns (default 0.01).
iterationsThe number of iterations for the gradient descent (default 1000).
regularizationParameterThe regularization parameter lambda (default 0.0, no regularization).

Member Function Documentation

◆ getBias()

double MultilinearRegression::getBias ( ) const
inline

Gets the current bias of the model.

Returns
The bias term.

◆ getWeights()

std::vector<double> MultilinearRegression::getWeights ( ) const
inline

Gets the current weights of the model.

Returns
A vector containing the weights.

◆ predict()

double MultilinearRegression::predict ( const std::vector< double > &  features) const
inline

Predicts the output for a given set of features.

Parameters
featuresA vector containing feature values for a single data point.
Returns
The predicted value.

◆ train()

void MultilinearRegression::train ( const std::vector< std::vector< double >> &  features,
const std::vector< double > &  target 
)
inline

Trains the Multilinear Regression model on the provided data.

Parameters
featuresA vector of vectors, where each sub-vector represents the features for one data point.
targetA vector containing the target values corresponding to each data point.
Exceptions
std::invalid_argumentIf the number of features does not match the target size.

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