TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Adaptive Linear Neuron (ADALINE) implementation More...
#include <array>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <numeric>
#include <vector>
Go to the source code of this file.
Classes | |
class | machine_learning::adaline |
Namespaces | |
namespace | machine_learning |
A* search algorithm | |
Functions | |
void | test1 (double eta=0.01) |
void | test2 (double eta=0.01) |
void | test3 (double eta=0.01) |
int | main (int argc, char **argv) |
Variables | |
constexpr int | MAX_ITER = 500 |
Adaptive Linear Neuron (ADALINE) implementation
ADALINE is one of the first and simplest single layer artificial neural network. The algorithm essentially implements a linear function
\[ f\left(x_0,x_1,x_2,\ldots\right) = \sum_j x_jw_j+\theta \]
where \(x_j\) are the input features of a sample, \(w_j\) are the coefficients of the linear function and \(\theta\) is a constant. If we know the \(w_j\), then for any given set of features, \(y\) can be computed. Computing the \(w_j\) is a supervised learning algorithm wherein a set of features and their corresponding outputs are given and weights are computed using stochastic gradient descent method.
Definition in file adaline_learning.cpp.
int main | ( | int | argc, |
char ** | argv ) |
Main function
Definition at line 357 of file adaline_learning.cpp.
void test1 | ( | double | eta = 0.01 | ) |
test function to predict points in a 2D coordinate system above the line \(x=y\) as +1 and others as -1. Note that each point is defined by 2 values or 2 features.
[in] | eta | learning rate (optional, default=0.01) |
Definition at line 224 of file adaline_learning.cpp.
void test2 | ( | double | eta = 0.01 | ) |
test function to predict points in a 2D coordinate system above the line \(x+3y=-1\) as +1 and others as -1. Note that each point is defined by 2 values or 2 features. The function will create random sample points for training and test purposes.
[in] | eta | learning rate (optional, default=0.01) |
Definition at line 262 of file adaline_learning.cpp.
void test3 | ( | double | eta = 0.01 | ) |
test function to predict points in a 3D coordinate system lying within the sphere of radius 1 and centre at origin as +1 and others as -1. Note that each point is defined by 3 values but we use 6 features. The function will create random sample points for training and test purposes. The sphere centred at origin and radius 1 is defined as: \(x^2+y^2+z^2=r^2=1\) and if the \(r^2<1\), point lies within the sphere else, outside.
[in] | eta | learning rate (optional, default=0.01) |
Definition at line 313 of file adaline_learning.cpp.