TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Files | |
file | adaline_learning.cpp |
Adaptive Linear Neuron (ADALINE) implementation | |
file | kohonen_som_topology.cpp |
Kohonen self organizing map (topological map) | |
file | kohonen_som_trace.cpp |
Kohonen self organizing map (data tracing) | |
Namespaces | |
namespace | machine_learning |
A* search algorithm | |
Functions | |
double | _random (double a, double b) |
int | save_2d_data (const char *fname, const std::vector< std::valarray< double > > &X) |
void | get_min_2d (const std::vector< std::valarray< double > > &X, double *val, int *x_idx, int *y_idx) |
int | save_nd_data (const char *fname, const std::vector< std::valarray< double > > &X) |
Variables | |
constexpr int | MAX_ITER = 500 |
#define _USE_MATH_DEFINES |
Definition at line 26 of file kohonen_som_topology.cpp.
#define _USE_MATH_DEFINES |
Definition at line 21 of file kohonen_som_trace.cpp.
double _random | ( | double | a, |
double | b ) |
Helper function to generate a random number in a given interval.
Steps:
r1 = rand() % 100
gets a random number between 0 and 99r2 = r1 / 100
converts random number to be between 0 and 0.99[in] | a | lower limit |
[in] | b | upper limit |
Definition at line 53 of file kohonen_som_topology.cpp.
void get_min_2d | ( | const std::vector< std::valarray< double > > & | X, |
double * | val, | ||
int * | x_idx, | ||
int * | y_idx ) |
Get minimum value and index of the value in a matrix
[in] | X | matrix to search |
[in] | N | number of points in the vector |
[out] | val | minimum value found |
[out] | idx_x | x-index where minimum value was found |
[out] | idx_y | y-index where minimum value was found |
Definition at line 105 of file kohonen_som_topology.cpp.
int save_2d_data | ( | const char * | fname, |
const std::vector< std::valarray< double > > & | X ) |
Save a given n-dimensional data martix to file.
[in] | fname | filename to save in (gets overwriten without confirmation) |
[in] | X | matrix to save |
Definition at line 65 of file kohonen_som_topology.cpp.
int save_nd_data | ( | const char * | fname, |
const std::vector< std::valarray< double > > & | X ) |
Save a given n-dimensional data martix to file.
[in] | fname | filename to save in (gets overwriten without confirmation) |
[in] | X | matrix to save |
Definition at line 58 of file kohonen_som_trace.cpp.
|
constexpr |
Maximum number of iterations to learn
Definition at line 40 of file adaline_learning.cpp.