![]() |
TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Public Member Functions | |
| adaline (int num_features, const double eta=0.01f, const double accuracy=1e-5) | |
| int | predict (const std::vector< double > &x, double *out=nullptr) |
| double | fit (const std::vector< double > &x, const int &y) |
| template<size_t N> | |
| void | fit (std::array< std::vector< double >, N > const &X, std::array< int, N > const &Y) |
| int | activation (double x) |
Private Member Functions | |
| bool | check_size_match (const std::vector< double > &x) |
Private Attributes | |
| const double | eta |
| learning rate of the algorithm | |
| const double | accuracy |
| model fit convergence accuracy | |
| std::vector< double > | weights |
| weights of the neural network | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const adaline &ada) |
Definition at line 46 of file adaline_learning.cpp.
|
inlineexplicit |
Default constructor
| [in] | num_features | number of features present |
| [in] | eta | learning rate (optional, default=0.1) |
| [in] | convergence | accuracy (optional, default= \(1\times10^{-5}\)) |
Definition at line 55 of file adaline_learning.cpp.
|
inline |
Defines activation function as Heaviside's step function.
\[f(x) = \begin{cases} -1 & \forall x \le 0\\ 1 & \forall x > 0 \end{cases} \]
| x | input value to apply activation on |
Definition at line 186 of file adaline_learning.cpp.
|
inlineprivate |
convenient function to check if input feature vector size matches the model weights size
| [in] | x | fecture vector to check |
Definition at line 196 of file adaline_learning.cpp.
|
inline |
Update the weights of the model using supervised learning for one feature vector
| [in] | x | feature vector |
| [in] | y | known output value |
Definition at line 119 of file adaline_learning.cpp.
|
inline |
Update the weights of the model using supervised learning for an array of vectors.
| [in] | X | array of feature vector |
| [in] | y | known output value for each feature vector |
Definition at line 145 of file adaline_learning.cpp.
|
inline |
predict the output of the model for given set of features
| [in] | x | input vector |
| [out] | out | optional argument to return neuron output before applying activation function (optional, nullptr to ignore) |
Definition at line 95 of file adaline_learning.cpp.
|
friend |
Operator to print the weights of the model
Definition at line 76 of file adaline_learning.cpp.
|
private |
model fit convergence accuracy
Definition at line 208 of file adaline_learning.cpp.
|
private |
learning rate of the algorithm
Definition at line 207 of file adaline_learning.cpp.
|
private |
weights of the neural network
Definition at line 209 of file adaline_learning.cpp.