SciLib.Neuro
Class RbfNet

java.lang.Object
  extended by SciLib.Neuro.Nnet
      extended by SciLib.Neuro.RbfNet

public class RbfNet
extends Nnet

This class defines A Radial Basis Function Network.


Field Summary
 integerVector[] c
          contains K-cluster indexes
protected  matrix G
           
protected  matrix G0
           
static int GENERALIZATIONRBFNW
           
static int INTERPOLATIONRBFNW
           
protected  double lambda
           
static int RADIALBFNW
           
protected  double radius
           
 matrix t
          The set of centers
protected  int type
           
 
Fields inherited from class SciLib.Neuro.Nnet
averageError, DesiredOutputMatrix, errorThreshold, g, hidden, hiddenSize, inSize, learningRate, momentum, numberOfHiddenLayers, NumberOfTestPatterns, NumberOfTrainingPatterns, output, outSize, testingData, testingDesiredOutput, trainingData, trainingDesiredOutput
 
Constructor Summary
RbfNet()
          Make a default Radial basis function network
RbfNet(int is, int os, int hs, int type)
          Make a Radial basis function network with specific size and type
RbfNet(int is, int os, int hs, int type, Activation phi)
          Make a Radial basis function network with specific size, type and activation function
 
Method Summary
 vector approximate(Function f, vector x)
           
 double classify(int type, integerVector result)
          classify the data from a test file
 void computeOutput(vector x)
          Compute the output from an input vector x
 double computePhiAt(vector x, int i)
          Compute phi(x_i)
 double computeRadius()
          Compute the radius = M/d^2
 void generateCenters(int method, int[] centers)
          generate centers for a radial basis function network
 void generateG0()
          Generate the matrix G0
 void generateGreenMatrix()
          Generate the Green matrix G
 void generateKCenters(int[] centers)
          Generate k fixed centers
 void generateRandomlyCenters()
          Genrate k centers randomly
 matrix getGreenMatrix()
          get Green matrix G
 java.lang.String getType()
          Get the radial basis function network type
 void initialize(double radius, double lambda, int type)
          initialize a radial basis function network
 void initialize(double radius, double lambda, int type, Activation phi)
          initialize a radial basis function network
 void interpolation(double lambda)
          Interpolation method
 vector makeTrainingDesiredOutputVector(int i)
          make a current training desired output vector
 void training(int trainingType, int[] c)
          Training the network
 void training(int trainingType, int[] c, double lambda)
          Training the network with a generalization parameter lambda
 
Methods inherited from class SciLib.Neuro.Nnet
generate, getErrorThreshold, getHiddenLayers, gethiddenSize, getInputSize, getLearningRate, getMomentumPar, getnumberOfHiddenLayers, getNumberOfTestPatterns, getNumberOfTrainingPatterns, getOutputLayer, getOutputSize, getTrainingData, getTrainingDesiredOutput, makeDesiredOutputMatrix, makeDesiredOutputMatrix, makeTrainingSet, readTestingData, readTrainingData, readWeight, setActivation, setErrorThreshold, setInputSize, setLearningRate, setMomentumPar, setNumberOfTestPatterns, setNumberOfTrainingPatterns, setOutputSize, setSize, writeWeight
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADIALBFNW

public static final int RADIALBFNW
See Also:
Constant Field Values

INTERPOLATIONRBFNW

public static final int INTERPOLATIONRBFNW
See Also:
Constant Field Values

GENERALIZATIONRBFNW

public static final int GENERALIZATIONRBFNW
See Also:
Constant Field Values

G

protected matrix G

G0

protected matrix G0

lambda

protected double lambda

radius

protected double radius

type

protected int type

t

public matrix t
The set of centers


c

public integerVector[] c
contains K-cluster indexes

Constructor Detail

RbfNet

public RbfNet()
Make a default Radial basis function network


RbfNet

public RbfNet(int is,
              int os,
              int hs,
              int type)
Make a Radial basis function network with specific size and type

Parameters:
is - An integer value, the input size
os - An integer value, the output size
hs - An integer value, the size of the hidden layer
type - An integer value, the type of radial basis function network

RbfNet

public RbfNet(int is,
              int os,
              int hs,
              int type,
              Activation phi)
Make a Radial basis function network with specific size, type and activation function

Parameters:
is - An integer value, the input size
os - An integer value, the output size
hs - An integer value, the size of the hidden layer
type - An integer value, the type of radial basis function network
phi - An Activation object
Method Detail

getGreenMatrix

public matrix getGreenMatrix()
get Green matrix G

Returns:
a matrix

getType

public java.lang.String getType()
Get the radial basis function network type

Returns:
A String

initialize

public void initialize(double radius,
                       double lambda,
                       int type)
initialize a radial basis function network

Parameters:
radius - A double value
lambda - A double value
type - A double value

initialize

public void initialize(double radius,
                       double lambda,
                       int type,
                       Activation phi)
initialize a radial basis function network

Parameters:
radius - A double value
lambda - A double value
type - A double value
phi - An Activation function

computePhiAt

public double computePhiAt(vector x,
                           int i)
Compute phi(x_i)

Parameters:
x - A vector
i - An integer value

computeRadius

public double computeRadius()
Compute the radius = M/d^2


generateCenters

public void generateCenters(int method,
                            int[] centers)
generate centers for a radial basis function network

Parameters:
method - 0 for randomly, 1 for k-mean clustering and 0 for fixed centers
centers - An integer array of indexes of fixed centers. It will be null for other methods

generateKCenters

public void generateKCenters(int[] centers)
Generate k fixed centers

Parameters:
centers - An integer array of indexes of fixed centers.

generateRandomlyCenters

public void generateRandomlyCenters()
Genrate k centers randomly


generateGreenMatrix

public void generateGreenMatrix()
Generate the Green matrix G


generateG0

public void generateG0()
Generate the matrix G0


computeOutput

public void computeOutput(vector x)
Compute the output from an input vector x

Parameters:
x - A vector

makeTrainingDesiredOutputVector

public vector makeTrainingDesiredOutputVector(int i)
make a current training desired output vector


training

public void training(int trainingType,
                     int[] c)
Training the network

Parameters:
trainingType - the training method, 0 for randomly, 1 for k-mean clustering and 0 for fixed centers
c - An integer array of indexes of fixed centers. It will be null for other methods

interpolation

public void interpolation(double lambda)
Interpolation method


training

public void training(int trainingType,
                     int[] c,
                     double lambda)
Training the network with a generalization parameter lambda

Parameters:
trainingType - the training method, 0 for randomly, 1 for k-mean clustering and 0 for fixed centers
c - An integer array of indexes of fixed centers. It will be null for other methods
lambda - A double value

classify

public double classify(int type,
                       integerVector result)
classify the data from a test file

Parameters:
type - An integer value, the classification method
result - An integerVector contains the classification result
Returns:
a double value, the correct classification in percent

approximate

public vector approximate(Function f,
                          vector x)