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

Support Vector Regression using the ε-insensitive loss function. More...

#include <SupportVectorRegression.hpp>

Public Types

enum class  KernelType { LINEAR , POLYNOMIAL , RBF }
 Kernel function types.
 

Public Member Functions

 SupportVectorRegression (double C=1.0, double epsilon=0.1, KernelType kernel_type=KernelType::RBF, int degree=3, double gamma=1.0, double coef0=0.0)
 Constructs a SupportVectorRegression model. More...
 
 ~SupportVectorRegression ()
 Destructor for SupportVectorRegression.
 
void fit (const std::vector< std::vector< double >> &X, const std::vector< double > &y)
 Fits the SVR model to the training data. More...
 
std::vector< double > predict (const std::vector< std::vector< double >> &X) const
 Predicts target values for the given input data. More...
 

Detailed Description

Support Vector Regression using the ε-insensitive loss function.

Constructor & Destructor Documentation

◆ SupportVectorRegression()

SupportVectorRegression::SupportVectorRegression ( double  C = 1.0,
double  epsilon = 0.1,
KernelType  kernel_type = KernelType::RBF,
int  degree = 3,
double  gamma = 1.0,
double  coef0 = 0.0 
)

Constructs a SupportVectorRegression model.

Parameters
CRegularization parameter.
epsilonEpsilon parameter in the ε-insensitive loss function.
kernel_typeType of kernel function to use.
degreeDegree for polynomial kernel.
gammaGamma parameter for RBF kernel.
coef0Independent term in polynomial kernel.

Member Function Documentation

◆ fit()

void SupportVectorRegression::fit ( const std::vector< std::vector< double >> &  X,
const std::vector< double > &  y 
)

Fits the SVR model to the training data.

Parameters
XA vector of feature vectors (training data).
yA vector of target values (training labels).

◆ predict()

std::vector< double > SupportVectorRegression::predict ( const std::vector< std::vector< double >> &  X) const

Predicts target values for the given input data.

Parameters
XA vector of feature vectors (test data).
Returns
A vector of predicted target values.

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