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
PolynomialRegression Class Reference

Polynomial Regression model for fitting polynomial curves. More...

#include <PolynomialRegression.hpp>

Public Member Functions

 PolynomialRegression (int degree, double regularizationParameter=0.0)
 Constructor initializing the polynomial degree. More...
 
void train (const std::vector< double > &x, const std::vector< double > &y)
 Train the model using features and target values. More...
 
double predict (double x) const
 Predicts the output for a given input value. More...
 
std::vector< double > getCoefficients () const
 Get the coefficients of the fitted polynomial. More...
 

Detailed Description

Polynomial Regression model for fitting polynomial curves.

Constructor & Destructor Documentation

◆ PolynomialRegression()

PolynomialRegression::PolynomialRegression ( int  degree,
double  regularizationParameter = 0.0 
)
inline

Constructor initializing the polynomial degree.

Parameters
degreeDegree of the polynomial.
regularizationParameterRegularization strength (default is 0.0, no regularization).

Member Function Documentation

◆ getCoefficients()

std::vector<double> PolynomialRegression::getCoefficients ( ) const
inline

Get the coefficients of the fitted polynomial.

Returns
Vector of coefficients.

◆ predict()

double PolynomialRegression::predict ( double  x) const
inline

Predicts the output for a given input value.

Parameters
xInput feature.
Returns
Predicted value.

◆ train()

void PolynomialRegression::train ( const std::vector< double > &  x,
const std::vector< double > &  y 
)
inline

Train the model using features and target values.

Parameters
xFeature vector.
yTarget vector.

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