GPUMLib  0.2.2
GPU Machine Learning Library
Macros | Typedefs | Functions | Variables
Radial Basis Functions Network functions.

Macros

#define imin(X, Y)   ((X) < (Y) ? (X) : (Y))
 Functions used to create a radial basis functions network that can be trained using the CUDA implementation of the Radial Basis Functions algorithm.
 

Typedefs

typedef std::pair< int, float > my_pair
 

Functions

void arrayShuffle (int *array, int length)
 
bool sort_pred (const my_pair &left, const my_pair &right)
 Sorting predicate, for use with the sort function.
 
int randint (int lowest, int highest)
 Generates a random Integer between lowest and highest values.
 
double euclidian_distance (const Eigen::MatrixXd &A, int idxA, const Eigen::MatrixXd &B, int idxB)
 
float basis_function (const Eigen::MatrixXd &A, int idxA, const Eigen::MatrixXd &B, int idxB, double(*f)(const Eigen::MatrixXd &, int, const Eigen::MatrixXd &, int))
 
Eigen::MatrixXd activation (const Eigen::MatrixXd &Input, const Eigen::MatrixXd &Centers)
 
Eigen::MatrixXd trainRBF (const Eigen::MatrixXd &Input, const Eigen::MatrixXd &Target, const Eigen::MatrixXd &Centers)
 
Eigen::MatrixXd testRBF (const Eigen::MatrixXd &Input, const Eigen::MatrixXd &Centers, const Eigen::MatrixXd &Weights)
 
Eigen::MatrixXd addCenter (const Eigen::MatrixXd &X, const Eigen::MatrixXd &Centers, int index)
 
void rbf (Eigen::MatrixXd Input, Eigen::MatrixXd Target, int network_size, int number_neighbours, Eigen::MatrixXd &OutWeights, Eigen::MatrixXd &OutCenters)
 

Variables

unsigned int seed = (unsigned)time(0)
 
float * c_width
 
float beta = 3
 

Detailed Description

Function Documentation

Eigen::MatrixXd activation ( const Eigen::MatrixXd &  Input,
const Eigen::MatrixXd &  Centers 
)

Generates an activation matrix between all Input samples and centers of rbf network.

Parameters
[in]InputMatrix with data samples.
[in]CentersCenters of rbf network.
Returns
Matrix with all activation values between samples and centers of rbf network.

Definition at line 128 of file rbf.h.

Eigen::MatrixXd addCenter ( const Eigen::MatrixXd &  X,
const Eigen::MatrixXd &  Centers,
int  index 
)

Add a center to the Center matrix.

Parameters
[in]XMatrix with data samples.
[in]CentersCenters of rbf network.
[in]indexIndex of the sample to add to the Centers.
Returns
Center matrix with additional entry.

Definition at line 176 of file rbf.h.

void arrayShuffle ( int *  array,
int  length 
)

Shuffles an array.

Parameters
[in]arrayArray to be shuffled.
[in]lengthSize of the array.

Definition at line 55 of file rbf.h.

float basis_function ( const Eigen::MatrixXd &  A,
int  idxA,
const Eigen::MatrixXd &  B,
int  idxB,
double(*)(const Eigen::MatrixXd &, int, const Eigen::MatrixXd &, int)  f 
)

Calculates the activation of a basis function for a given row and column in matrix A and B.

Parameters
[in]AMatrix A.
[in]idxARow in matrix A.
[in]BMatrix B.
[in]idxBColumn in matrix B.
[in]fFunction to use to calculate distance.
Returns
Value of activation function.

Definition at line 115 of file rbf.h.

double euclidian_distance ( const Eigen::MatrixXd &  A,
int  idxA,
const Eigen::MatrixXd &  B,
int  idxB 
)

Calculate the euclidian distance between a row and a column on two given matrixes.

Parameters
[in]AMatrix A.
[in]idxARow in matrix A.
[in]BMatrix B.
[in]idxBColumn in matrix B.
Returns
Euclidian distance.

Definition at line 87 of file rbf.h.

void rbf ( Eigen::MatrixXd  Input,
Eigen::MatrixXd  Target,
int  network_size,
int  number_neighbours,
Eigen::MatrixXd &  OutWeights,
Eigen::MatrixXd &  OutCenters 
)

Function that generates and calculates the RBF network, for the given Input samples.

Parameters
[in]InputMatrix with data samples.
[in]TargetTargets for each sample.
[in]network_sizeNumber of centers to be used in the RBF network.
[in]number_neighboursNumber of neighbours used to estimate the width of the gaussian function for each center.
[out]OutWeightsCalculated weights for the RBF network.
[out]OutCentersCalculated centers for the RBF network.

Definition at line 193 of file rbf.h.

Eigen::MatrixXd testRBF ( const Eigen::MatrixXd &  Input,
const Eigen::MatrixXd &  Centers,
const Eigen::MatrixXd &  Weights 
)

Tests an RBF network.

Parameters
[in]InputMatrix with data samples.
[in]CentersCenters of rbf network.
[in]WeightsWeights of the trained RBF network.
Returns
Results of the application of the RBF network.

Definition at line 165 of file rbf.h.

Eigen::MatrixXd trainRBF ( const Eigen::MatrixXd &  Input,
const Eigen::MatrixXd &  Target,
const Eigen::MatrixXd &  Centers 
)

Trains an RBF network.

Parameters
[in]InputMatrix with data samples.
[in]TargetTargets for each sample.
[in]CentersCenters of the RBF network.
Returns
Weights of trained network.

Definition at line 152 of file rbf.h.