jml.classification
Class LogisticRegressionMCBoundConstrainedPLBFGS

java.lang.Object
  extended by jml.classification.Classifier
      extended by jml.classification.LogisticRegressionMCBoundConstrainedPLBFGS
All Implemented Interfaces:
java.io.Serializable

public class LogisticRegressionMCBoundConstrainedPLBFGS
extends Classifier

Multi-class logistic regression by using projected limited-memory BFGS method. Projection matrix is bound constrained.

We aim to minimize the cross-entropy error function defined by

E(W) = -ln{p(T|w1, w2,..., wK)} / N = -sum_n{sum_k{t_{nk}ln(v_nk)}} / N,

where \nabla E(W) = X * (V - T) / N and v_nk = P(C_k|x_n).

Version:
1.0 Jan. 12th, 2013
Author:
Mingjie Qian
See Also:
Serialized Form

Field Summary
private static long serialVersionUID
           
 
Fields inherited from class jml.classification.Classifier
epsilon, IDLabelMap, labelIDs, labels, nClass, nExample, nFeature, W, X, Y
 
Constructor Summary
LogisticRegressionMCBoundConstrainedPLBFGS(Options options)
           
 
Method Summary
 void loadModel(java.lang.String filePath)
          Load the model for a classifier.
static void main(java.lang.String[] args)
           
 org.apache.commons.math.linear.RealMatrix predictLabelScoreMatrix(org.apache.commons.math.linear.RealMatrix X)
          Predict the label score matrix given test data formated as an original data matrix.
 void saveModel(java.lang.String filePath)
          Save the model for a classifier.
 void train()
          Train the classifier.
 
Methods inherited from class jml.classification.Classifier
calcNumClass, feedData, feedData, feedLabels, feedLabels, feedLabels, getAccuracy, getIDLabelMap, getLabelIDMap, getProjectionMatrix, getTrainingLabelMatrix, labelIndexArray2LabelMatrix, labelScoreMatrix2LabelIndexArray, predict, predict, predictLabelMatrix, predictLabelMatrix, predictLabelScoreMatrix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

LogisticRegressionMCBoundConstrainedPLBFGS

public LogisticRegressionMCBoundConstrainedPLBFGS(Options options)
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args -

train

public void train()
Description copied from class: Classifier
Train the classifier.

Specified by:
train in class Classifier

predictLabelScoreMatrix

public org.apache.commons.math.linear.RealMatrix predictLabelScoreMatrix(org.apache.commons.math.linear.RealMatrix X)
Description copied from class: Classifier
Predict the label score matrix given test data formated as an original data matrix. Note that if a method of an abstract class is declared as abstract, it is implemented as an interface function in Java. Thus subclass needs to implement this abstract method rather than to override it.

Specified by:
predictLabelScoreMatrix in class Classifier
Parameters:
X - test data matrix with each column being a feature vector
Returns:
predicted N x K label score matrix, where N is the number of test samples, and K is the number of classes

loadModel

public void loadModel(java.lang.String filePath)
Description copied from class: Classifier
Load the model for a classifier.

Specified by:
loadModel in class Classifier
Parameters:
filePath - file path to load the model

saveModel

public void saveModel(java.lang.String filePath)
Description copied from class: Classifier
Save the model for a classifier.

Specified by:
saveModel in class Classifier
Parameters:
filePath - file path to save the model