openGPMP
Open Source Mathematics Package
|
Training Algorithms. More...
#include <trainers.hpp>
Public Member Functions | |
std::vector< double > | gradientdesc (const std::vector< std::vector< double >> &X, const std::vector< double > &y, double alpha, int num_iters) |
Perform gradient descent for linear regression. More... | |
std::vector< double > | stoch_gradientdesc (const std::vector< std::vector< double >> &X, const std::vector< double > &y, double alpha, int num_iters) |
Perform stochastic gradient descent for linear regression. More... | |
std::vector< double > | minibatch_gradientdesc (const std::vector< std::vector< double >> &X, const std::vector< double > &y, double alpha, int num_iters, int batch_size) |
Perform mini-batch gradient descent for linear regression. More... | |
std::vector< double > gpmp::ml::Trainers::gradientdesc | ( | const std::vector< std::vector< double >> & | X, |
const std::vector< double > & | y, | ||
double | alpha, | ||
int | num_iters | ||
) |
Perform gradient descent for linear regression.
Given features X, target y, learning rate alpha, and number of iterations num_iters, this function optimizes the parameters theta using gradient descent
X | Features matrix (each row represents a training example) |
y | Target vector |
alpha | Learning rate |
num_iters | Number of iterations |
Definition at line 37 of file trainers.cpp.
std::vector< double > gpmp::ml::Trainers::minibatch_gradientdesc | ( | const std::vector< std::vector< double >> & | X, |
const std::vector< double > & | y, | ||
double | alpha, | ||
int | num_iters, | ||
int | batch_size | ||
) |
Perform mini-batch gradient descent for linear regression.
Given features X, target y, learning rate alpha, number of iterations num_iters, and batch size batch_size, this function optimizes the parameters theta using mini-batch gradient descent
X | Features matrix (each row represents a training example) |
y | Target vector |
alpha | Learning rate |
num_iters | Number of iterations |
batch_size | Size of mini-batch |
Definition at line 103 of file trainers.cpp.
std::vector< double > gpmp::ml::Trainers::stoch_gradientdesc | ( | const std::vector< std::vector< double >> & | X, |
const std::vector< double > & | y, | ||
double | alpha, | ||
int | num_iters | ||
) |
Perform stochastic gradient descent for linear regression.
Given features X, target y, learning rate alpha, and number of iterations num_iters, this function optimizes the parameters theta using stochastic gradient descent
X | Features matrix (each row represents a training example) |
y | Target vector |
alpha | Learning rate |
num_iters | Number of iterations |
Definition at line 73 of file trainers.cpp.