GPUMLib  0.2.2
GPU Machine Learning Library
Classes | Public Member Functions | Friends | List of all members

Represents a Restricted Boltzman Machine (GPU). More...

#include <RBM.h>

Public Member Functions

bool Init (int miniBatchSize, int cd)
 
void DisposeDeviceInformation ()
 
 RBM (int visibleUnits, int hiddenUnits, HostMatrix< cudafloat > &inputs, cudafloat initialLearningRate, cudafloat momentum=DEFAULT_MOMENTUM, bool useBinaryValuesVisibleReconstruction=false, cudafloat stdWeights=STD_WEIGHTS, int proportionRandomValuesGenerated=1)
 
void RandomizeWeights ()
 Randomizes the weights of the RBM.
 
void RandomizeWeights (cudafloat stdWeights)
 
void RandomizeWeights (cudafloat stdWeights, cudafloat initialLearningRate)
 
void ContrastiveDivergence (int n)
 
cudafloat GetMSEestimate ()
 
cudafloat GetMSE ()
 
int Epoch () const
 
HostMatrix< cudafloatGetWeights ()
 
HostArray< cudafloatGetVisibleBias ()
 
HostArray< cudafloatGetHiddenBias ()
 
int GetNumberInputs () const
 
int GetNumberOutputs () const
 

Friends

class DBN
 

Detailed Description

Represents a Restricted Boltzman Machine (GPU).

Examples:
DBNapp.cpp.

Definition at line 44 of file RBM.h.

Constructor & Destructor Documentation

RBM ( int  visibleUnits,
int  hiddenUnits,
HostMatrix< cudafloat > &  inputs,
cudafloat  initialLearningRate,
cudafloat  momentum = DEFAULT_MOMENTUM,
bool  useBinaryValuesVisibleReconstruction = false,
cudafloat  stdWeights = STD_WEIGHTS,
int  proportionRandomValuesGenerated = 1 
)
inline

Constructs a Restricted Boltzman Machine that can be trained using a device (GPU).

Parameters
visibleUnitsNumber of inputs.
hiddenUnitsNumber of hidden neurons.
inputsInputs of the training dataset. Each row of the matrix should contain a pattern (sample) and each column an input.
initialLearningRateInitial learning rate.
momentumMomentum (optional).
useBinaryValuesVisibleReconstructionUse binary values for the visibible layer reconstruction (optional, default = false)
stdWeightsDefines the maximum and minimum value for the weights. The weights will be initialized with a random number between -stdWeights and stdWeights.
proportionRandomValuesGeneratedProportion of random values generated (currently ignored).
See also
Init

Definition at line 224 of file RBM.h.

Member Function Documentation

void ContrastiveDivergence ( int  n)

Trains the RBM for one epoch using the CD-n algorithm

Parameters
nValue of n in the CD-n algorithm

Definition at line 87 of file rbm.cu.

void DisposeDeviceInformation ( )
inline

Disposes the information contained in the device (GPU) memory. The RBM can not be trained afterwards. This method is called automatically if an RBM on top of this one is initialized.

See also
Init

Definition at line 194 of file RBM.h.

int Epoch ( ) const
inline

Gets the current epoch

Returns
the training epoch
Examples:
DBNapp.cpp.

Definition at line 285 of file RBM.h.

HostArray<cudafloat> GetHiddenBias ( )
inline

Gets the hidden units bias

Returns
an array with the bias
Examples:
DBNapp.cpp.

Definition at line 305 of file RBM.h.

cudafloat GetMSE ( )
inline

Gets an approximation the reconstruction mean square error of the network. The value given is the one of the previous epoch (hence an approximation of the current).

Returns
An aproximation of (actual) the reconstruction mean square error.
Attention
Do not use during training or it will slow down considerably the training process. Use GetMSEestimate instead.
See also
GetMSEestimate
Examples:
DBNapp.cpp.

Definition at line 274 of file RBM.h.

cudafloat GetMSEestimate ( )
inline

Gets an estimate of the reconstruction mean square error of the network.

Returns
An estimate of the reconstruction mean square error.
See also
GetMSE

Definition at line 258 of file RBM.h.

int GetNumberInputs ( ) const
inline

Gets the number of inputs

Returns
the number of inputs

Definition at line 312 of file RBM.h.

int GetNumberOutputs ( ) const
inline

Gets the number of outputs (neurons in the RBM hidden layer)

Returns
the number of outputs

Definition at line 318 of file RBM.h.

HostArray<cudafloat> GetVisibleBias ( )
inline

Gets the visible units bias

Returns
an array with the bias
Examples:
DBNapp.cpp.

Definition at line 298 of file RBM.h.

HostMatrix<cudafloat> GetWeights ( )
inline

Gets the weights matrix

Returns
the weights matrix
Examples:
DBNapp.cpp.

Definition at line 291 of file RBM.h.

bool Init ( int  miniBatchSize,
int  cd 
)
inline

Initializes the RBM on the device (GPU). Must be called before performing any other operation.

Returns
true if the initialization was successful.
See also
Dispose

Definition at line 152 of file RBM.h.

void RandomizeWeights ( cudafloat  stdWeights)
inline

Randomizes the weights of the RBM, between -stdWeights and stdWeights.

Parameters
stdWeightsDefines the maximum and minimum value for the weights.

Definition at line 238 of file RBM.h.

void RandomizeWeights ( cudafloat  stdWeights,
cudafloat  initialLearningRate 
)
inline

Randomizes the weights of the RBM, between -stdWeights and stdWeights.

Parameters
stdWeightsDefines the maximum and minimum value for the weights.
initialLearningRateInitial learning rate.

Definition at line 246 of file RBM.h.


The documentation for this class was generated from the following files: