public class RBFNet extends Object implements Classifier, Regressor, DataTransform, Parameterized
LVQ
algorithm. In a classical RBF
Network, the distance between two data points is generally the
EuclideanDistance
or MahalanobisDistance
. This implementation
allows the specification of any arbitrary distance metric. Modifier and Type | Class and Description |
---|---|
static class |
RBFNet.Phase1Learner
The first phase of learning a RBF Neural Network is to determine the
neuron locations.
|
static class |
RBFNet.Phase2Learner
The second phase of learning a RBF Neural Network is to determine how the
neurons are activated to produce the output of the hidden layer.
|
Constructor and Description |
---|
RBFNet()
Creates a new RBF Network suitable for binary classification or
regression and uses 100 hidden nodes.
|
RBFNet(int numCentroids)
Creates a new RBF Network suitable for binary classification or
regression.
|
RBFNet(int numCentroids,
RBFNet.Phase1Learner cl,
RBFNet.Phase2Learner bl,
double alpha,
int p,
DistanceMetric dm,
Classifier baseClassifier)
Creates a new RBF Network for classification tasks.
|
RBFNet(int numCentroids,
RBFNet.Phase1Learner cl,
RBFNet.Phase2Learner bl,
double alpha,
int p,
DistanceMetric dm,
Regressor baseRegressor)
Creates a new RBF Network for regression tasks.
|
RBFNet(RBFNet toCopy)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
CategoricalResults |
classify(DataPoint data)
Performs classification on the given data point.
|
RBFNet |
clone() |
void |
fit(DataSet data)
Fits this transform to the given dataset.
|
double |
getAlpha()
Returns the alpha bandwidth learning parameter
|
DistanceMetric |
getDistanceMetric()
Returns the distance metric in use
|
int |
getNumCentroids()
Returns the number of centroids to use when training
|
int |
getP()
Returns the nearest neighbors parameter.
|
Parameter |
getParameter(String paramName)
Returns the parameter with the given name.
|
List<Parameter> |
getParameters()
Returns the list of parameters that can be altered for this learner.
|
RBFNet.Phase1Learner |
getPhase1Learner()
Returns the method to use for learning the centroids of the network.
|
RBFNet.Phase2Learner |
getPhase2Learner()
Returns the learning method to use for determining the bandwidths of each
center in the network.
|
static Distribution |
guessAlpha(DataSet data)
Guesses the distribution for the
setAlpha(double) parameter |
static Distribution |
guessNumCentroids(DataSet data)
Guesses the distribution for the
setNumCentroids(int) parameter |
static Distribution |
guessP(DataSet data)
Guesses the distribution for the
setP(int) parameter |
boolean |
isNormalize()
Returns whether or not the network is currently normalizing its neuron
outputs.
|
double |
regress(DataPoint data) |
void |
setAlpha(double alpha)
Sets the alpha parameter.
|
void |
setDistanceMetric(DistanceMetric dm)
Sets the distance metric used to determine neuron activations.
|
void |
setNormalize(boolean normalize)
Sets whether or not to normalize the outputs of the neurons in the
network so that the activations sum to one.
|
void |
setNumCentroids(int numCentroids)
Sets the number of centroids to learn for this model.
|
void |
setP(int p)
Sets the nearest neighbor parameter.
|
void |
setPhase1Learner(RBFNet.Phase1Learner p1l)
Sets the method used for learning the centroids (or hidden units) of the
network.
|
void |
setPhase2Learner(RBFNet.Phase2Learner p2l)
Sets the method used for learning the bandwidths for each centroid in the
network.
|
boolean |
supportsWeightedData()
Indicates whether the model knows how to train using weighted data points.
|
void |
train(RegressionDataSet dataSet) |
void |
train(RegressionDataSet dataSet,
ExecutorService threadPool) |
void |
trainC(ClassificationDataSet dataSet)
Trains the classifier and constructs a model for classification using the
given data set.
|
void |
trainC(ClassificationDataSet dataSet,
ExecutorService threadPool)
Trains the classifier and constructs a model for classification using the
given data set.
|
DataPoint |
transform(DataPoint dp)
Returns a new data point that is a transformation of the original data
point.
|
public RBFNet()
RBFNet.Phase1Learner.K_MEANS
for neuron selection and
RBFNet.Phase2Learner.NEAREST_OTHER_CENTROID_AVERAGE
for activation
tuning. The EuclideanDistance
will be use as the metric.public RBFNet(int numCentroids)
RBFNet.Phase1Learner.K_MEANS
for neuron selection and
RBFNet.Phase2Learner.NEAREST_OTHER_CENTROID_AVERAGE
for activation tuning.
The EuclideanDistance
will be use as the metric.numCentroids
- the number of centroids or neurons to use in the
network's hidden layerpublic RBFNet(int numCentroids, RBFNet.Phase1Learner cl, RBFNet.Phase2Learner bl, double alpha, int p, DistanceMetric dm, Classifier baseClassifier)
numCentroids
- the number of centroids or neurons to use in the
network's hidden layercl
- the method to learn the neuron locationsbl
- the method to learn the neuron activationsalpha
- a parameter that may have an effect on the neuron activation
learning method.p
- a parameter that may have an effect on the neuron activation
learning methoddm
- the distance metric to usebaseClassifier
- the base classifier to learn on top of the hidden
layer activations.public RBFNet(int numCentroids, RBFNet.Phase1Learner cl, RBFNet.Phase2Learner bl, double alpha, int p, DistanceMetric dm, Regressor baseRegressor)
numCentroids
- the number of centroids or neurons to use in the
network's hidden layercl
- the method to learn the neuron locationsbl
- the method to learn the neuron activationsalpha
- a parameter that may have an effect on the neuron activation
learning method.p
- a parameter that may have an effect on the neuron activation
learning methoddm
- the distance metric to usebaseRegressor
- the base regressor to learn on op of the hidden
layer activations.public RBFNet(RBFNet toCopy)
toCopy
- the network to copypublic DataPoint transform(DataPoint dp)
DataTransform
transform
in interface DataTransform
dp
- the data point to apply a transformation topublic void setAlpha(double alpha)
RBFNet.Phase2Learner
learners as a parameter. A good default value for
most methods is often 1 or 3. However the parameter must always be
a non-negative value.alpha
- a non negative value that controls the width of the learned
bandwidths.public double getAlpha()
setAlpha(double)
public static Distribution guessAlpha(DataSet data)
setAlpha(double)
parameterdata
- the data to create a guess forpublic void setP(int p)
RBFNet.Phase2Learner
learners as a parameter. It is used to control the
number of neighbors taken into account in learning the parameter value.
It must always be a positive value. 3 is usually a good value for
this parameter.p
- the positive integer used that controls the width of the learned
bandwidthspublic int getP()
setP(int)
public static Distribution guessP(DataSet data)
setP(int)
parameterdata
- the data to create a guess forpublic void setNumCentroids(int numCentroids)
setPhase1Learner(jsat.classifiers.neuralnetwork.RBFNet.Phase1Learner)
methodnumCentroids
- the number of centroids to use in the modelpublic int getNumCentroids()
public static Distribution guessNumCentroids(DataSet data)
setNumCentroids(int)
parameterdata
- the data to create a guess forpublic void setDistanceMetric(DistanceMetric dm)
dm
- the distance metric to usepublic DistanceMetric getDistanceMetric()
public void setPhase1Learner(RBFNet.Phase1Learner p1l)
p1l
- the learning method to usepublic RBFNet.Phase1Learner getPhase1Learner()
public void setPhase2Learner(RBFNet.Phase2Learner p2l)
setAlpha(double)
or
setP(int)
may impact the learned bandwidths.p2l
- the learning method to usepublic RBFNet.Phase2Learner getPhase2Learner()
public void setNormalize(boolean normalize)
true
normalize
- true
to normalize the neuron outputs,
false
to use the raw activation values.public boolean isNormalize()
public CategoricalResults classify(DataPoint data)
Classifier
classify
in interface Classifier
data
- the data point to classifypublic void trainC(ClassificationDataSet dataSet, ExecutorService threadPool)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onthreadPool
- the source of threads to use.public void trainC(ClassificationDataSet dataSet)
Classifier
trainC
in interface Classifier
dataSet
- the data set to train onpublic boolean supportsWeightedData()
Classifier
supportsWeightedData
in interface Classifier
supportsWeightedData
in interface Regressor
public void fit(DataSet data)
DataTransform
FailedToFitException
exception may be
thrown.fit
in interface DataTransform
data
- the dataset to fir this transform topublic void train(RegressionDataSet dataSet, ExecutorService threadPool)
public void train(RegressionDataSet dataSet)
public RBFNet clone()
clone
in interface Classifier
clone
in interface DataTransform
clone
in interface Regressor
clone
in class Object
public List<Parameter> getParameters()
Parameterized
getParameters
in interface Parameterized
public Parameter getParameter(String paramName)
Parameterized
getParameter
in interface Parameterized
paramName
- the name of the parameter to obtainCopyright © 2017. All rights reserved.