openGPMP
Open Source Mathematics Package
trainers.hpp
Go to the documentation of this file.
1 /*************************************************************************
2  *
3  * Project
4  * _____ _____ __ __ _____
5  * / ____| __ \| \/ | __ \
6  * ___ _ __ ___ _ __ | | __| |__) | \ / | |__) |
7  * / _ \| '_ \ / _ \ '_ \| | |_ | ___/| |\/| | ___/
8  *| (_) | |_) | __/ | | | |__| | | | | | | |
9  * \___/| .__/ \___|_| |_|\_____|_| |_| |_|_|
10  * | |
11  * |_|
12  *
13  * Copyright (C) Akiel Aries, <akiel@akiel.org>, et al.
14  *
15  * This software is licensed as described in the file LICENSE, which
16  * you should have received as part of this distribution. The terms
17  * among other details are referenced in the official documentation
18  * seen here : https://akielaries.github.io/openGPMP/ along with
19  * important files seen in this project.
20  *
21  * You may opt to use, copy, modify, merge, publish, distribute
22  * and/or sell copies of the Software, and permit persons to whom
23  * the Software is furnished to do so, under the terms of the
24  * LICENSE file. As this is an Open Source effort, all implementations
25  * must be of the same methodology.
26  *
27  *
28  *
29  * This software is distributed on an AS IS basis, WITHOUT
30  * WARRANTY OF ANY KIND, either express or implied.
31  *
32  ************************************************************************/
33 
40 #ifndef TRAINERS_HPP
41 #define TRAINERS_HPP
42 #include <fstream>
43 #include <iostream>
44 #include <string>
45 #include <vector>
46 
47 namespace gpmp {
48 
49 namespace ml {
50 
54 class Trainers {
55  public:
70  std::vector<double> gradientdesc(const std::vector<std::vector<double>> &X,
71  const std::vector<double> &y,
72  double alpha,
73  int num_iters);
74 
89  std::vector<double>
90  stoch_gradientdesc(const std::vector<std::vector<double>> &X,
91  const std::vector<double> &y,
92  double alpha,
93  int num_iters);
94 
110  std::vector<double>
111  minibatch_gradientdesc(const std::vector<std::vector<double>> &X,
112  const std::vector<double> &y,
113  double alpha,
114  int num_iters,
115  int batch_size);
116 };
117 
118 } // namespace ml
119 
120 } // namespace gpmp
121 
122 #endif
Training Algorithms.
Definition: trainers.hpp:54
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.
Definition: trainers.cpp:103
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.
Definition: trainers.cpp:37
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.
Definition: trainers.cpp:73
The source C++ openGPMP namespace.