A class that implements Multilinear Regression for predicting values based on multiple features.
More...
#include <MultiLinearRegression.hpp>
|
| 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...
|
|
A class that implements Multilinear Regression for predicting values based on multiple features.
◆ 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
-
learningRate | The rate at which the model learns (default 0.01). |
iterations | The number of iterations for the gradient descent (default 1000). |
regularizationParameter | The regularization parameter lambda (default 0.0, no regularization). |
◆ 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
-
features | A 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
-
features | A vector of vectors, where each sub-vector represents the features for one data point. |
target | A vector containing the target values corresponding to each data point. |
- Exceptions
-
std::invalid_argument | If the number of features does not match the target size. |
The documentation for this class was generated from the following file: