Class AlgorithmRVM
java.lang.Object
Algorithm
AlgorithmRVM
- All Implemented Interfaces:
- java.lang.Runnable
public class AlgorithmRVM
- extends Algorithm
Algorithm Relevance Vector Machines
|
Method Summary |
void |
computeDecisionRegions()
Computes the line of discrimination for the classification
algorithms when the corresponding flags have been initialized |
void |
computeErrors()
Computes the classification error for the data points |
double |
computeLikelihood()
Computes the log likelihood of the weights given the
data. |
boolean |
computeSigma()
Computes the sigma valued defined on pp. |
boolean |
computeVarianceCholesky()
Computes the diagonal elements of the inverse from the
cholesky decomposition |
boolean |
initFullTrain()
initializes the data structures in preparation for a full training
pass |
boolean |
initialize()
Overrides the initialize() method in the base class. |
boolean |
irlsTrain()
Completes one pass of IRLS training to update the weights
given the currently assigne hyperparamters. |
boolean |
pruneAndUpdate()
prunes off vectors whose hyperparameters have gone to infinity and
updates working data sets |
boolean |
pruneWeights()
Prunes off vectors which attain a zero weight during
training. |
void |
run()
Implementation of the run function from the Runnable interface. |
boolean |
trainFull()
this method trains an RVM probabilistic classifier on the input data and
targets provided. |
boolean |
updateHyperparametersFull()
Updates the hyperparameter values |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AlgorithmRVM
public AlgorithmRVM()
initialize
public boolean initialize()
- Overrides the initialize() method in the base class. Initializes
member data and prepares for execution of first step. This method
"resets" the algorithm.
- Specified by:
initialize in class Algorithm
- Returns:
- true
run
public void run()
- Implementation of the run function from the Runnable interface.
Determines what the current step is and calls the appropriate method.
- Specified by:
run in interface java.lang.Runnable- Specified by:
run in class Algorithm
trainFull
public boolean trainFull()
- this method trains an RVM probabilistic classifier on the input data and
targets provided. the inputs and targets should have a one-to-one
correspondence and all targets should be either 0 (out-of-class) or
1 (in-class). The training scheme follows that of [1] section 3.
It is assumed that the class data and targets are already set when
this method is called.
the training algorithm in [1] for RVMs proceeds in three iterative steps
1. prune away any weights whose hyperparameters have gone to infinity
2. estimate most probable weights: in this step we find those
weights that maximize equation (24) of [1]. The iteratively
reweighted least squares algorithm is used to find w_mp
3. estimate the covariance of a Gaussian approximation to the
posterior distribution (the posterior is what we want to
model in the end) over the weights centered at the weights,
w_mp.
4. estimate the hyperparameters that govern the weights. this
is done by evaluating the derivative over the hyperparameters
and finding the maximizing hyperparameters.
1, 2, 3, and 4 are carried out iteratively until a suitable convergence
criteria is satisfied.
- Returns:
- boolean value indicating status
initFullTrain
public boolean initFullTrain()
- initializes the data structures in preparation for a full training
pass
- Returns:
- boolean value indicating status
updateHyperparametersFull
public boolean updateHyperparametersFull()
- Updates the hyperparameter values
- Returns:
- boolean value indicating status
irlsTrain
public boolean irlsTrain()
- Completes one pass of IRLS training to update the weights
given the currently assigne hyperparamters. In this step, we find
those weights that maximize equation (24) of [1]. The iteratively
reweighted least squares algorithm is used to find w_mp. It proceeds
as follows:
a. initialize
b. loop until convergence
1. compute the B matrix
2. compute the Hessian and the gradient
3. update weights with formula
new weights = weights - inv(Hessian) * gradient
4. check convergence
- Returns:
- boolean value indicating status
pruneAndUpdate
public boolean pruneAndUpdate()
- prunes off vectors whose hyperparameters have gone to infinity and
updates working data sets
- Returns:
- true
pruneWeights
public boolean pruneWeights()
- Prunes off vectors which attain a zero weight during
training. Auxiliary data structures that are indexed according to the
working set are also updated.
- Returns:
- true
computeVarianceCholesky
public boolean computeVarianceCholesky()
- Computes the diagonal elements of the inverse from the
cholesky decomposition
- Returns:
- true
computeSigma
public boolean computeSigma()
- Computes the sigma valued defined on pp. 218 of [1].
- Returns:
- true
computeLikelihood
public double computeLikelihood()
- Computes the log likelihood of the weights given the
data. We would expect this value to increase as training proceeds
- Returns:
- Likelihood of weights given the data
computeDecisionRegions
public void computeDecisionRegions()
- Computes the line of discrimination for the classification
algorithms when the corresponding flags have been initialized
computeErrors
public void computeErrors()
- Computes the classification error for the data points