|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.imsl.datamining.neural.BinaryClassification
public class BinaryClassification
Classifies patterns into two classes.
Uses a FeedForwardNetwork
to solve binary classification problems.
In these problems, the target output for the network is the probability that
the pattern falls into one of two classes. The first class, ,
is usually equal to one and the second class,
equal to zero. These probabilities are then used to assign patterns to one
of the two classes. Typical applications include determining whether a
credit applicant is a good or bad credit risk, and determining whether a
person should or should not receive a particular treatment based upon their
physical, clinical and laboratory information. This class signals that network
training will minimize the binary cross-entropy error, and that network output
is the probability that the pattern belongs to the first class,
. Which is calculated by applying the logistic
activation function to the potential of the single output. The probability
for the second class is calculated by .
Constructor Summary | |
---|---|
BinaryClassification(Network network)
Creates a binary classifier. |
Method Summary | |
---|---|
double[] |
computeStatistics(double[][] xData,
int[] yData)
Computes the classification error statistics for the supplied network patterns and their associated classifications. |
QuasiNewtonTrainer.Error |
getError()
Returns the error function for use by QuasiNewtonTrainer
for training a binary classification network. |
Network |
getNetwork()
Returns the network being used for classification. |
int |
predictedClass(double[] x)
Calculates the classification probablities for the input pattern x , and returns either 0 or 1 identifying the class with the
highest probability. |
double[] |
probabilities(double[] x)
Returns classification probabilities for the input pattern x . |
void |
train(Trainer trainer,
double[][] xData,
int[] yData)
Trains the classification neural network using supplied trainer and patterns. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BinaryClassification(Network network)
network
- is the neural network used for classification.
Its OutputPerceptron
s should use the logistic activation
function, Activation.LOGISTIC
.Method Detail |
---|
public double[] computeStatistics(double[][] xData, int[] yData)
The first element returned is the binary cross-entropy error; the second is the classification error rate. The classification error rate is calculated by comparing the estimated classification probabilities to the target classifications. If the estimated probability for the target class is less than 0.5, then this is tallied as a classification error.
xData
- A double
matrix specifying the input
training patterns. The number of columns in xData
must equal the number of Node
s in
the InputLayer
.yData
- An int
containing the output classification
patterns. The values in yData
must be 0 or 1.
double
array containing the binary
cross-entropy error and the classification error rate.public QuasiNewtonTrainer.Error getError()
QuasiNewtonTrainer
for training a binary classification network.
public Network getNetwork()
public int predictedClass(double[] x)
x
, and returns either 0 or 1 identifying the class with the
highest probability.
This method is used to classify patterns into one of the two target classes based upon the pattern's values. The predicted classification is the class with the largest probability, i.e. greater than 0.5.
x
- the double
array containing the network input
patterns to classify. The length of x
should be
equal to the number of inputs in the network.
x
.
This will be either 0 or 1.public double[] probabilities(double[] x)
x
.
Calculates the two probabilities for the pattern supplied:
and .
The probability that the pattern belongs to the first class,
, is estmated using the logistic function of
the OutputPerceptron
's potential. The probability for the second class
is claculated as . The predicted
classification is the class with the largest probability, i.e. greater
than 0.5.
x
- a double
array containing the network input
pattern to classify. The length of x
must equal
the number of nodes in the input layer.
x
being in class ,
followed by the probability of x
being in class .public void train(Trainer trainer, double[][] xData, int[] yData)
trainer
- A Trainer
object, which is used to train the
network. The error function in any QuasiNewton
trainer included in trainer
should be set to
the error function from this class using the getError
method provided by this class.xData
- A double
matrix containing the input training
patterns. The number of columns in xData
must
equal the number of nodes in the input layer. Each row of
xData
contains a training pattern.yData
- An int
array containing the output classification values.
These values must be 0 or 1.
|
JMSLTM Numerical Library 6.1 | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |