|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.cs.sb.drem.DREM_FastLogistic2
public final class DREM_FastLogistic2
Class implements a logistic regression classifier trained with an L1 penalty. The L1 penalty promotes sparsity in the classifier Implementation based on the following paper Krishnapuram, B., Figueiredo, M., Carin, L., and Hartemink, A. Sparse Multinomial Logistic Regression: Fast Algorithms and Generalization Bounds. IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 27, June 2005. pp. 957-968.
Constructor Summary | |
---|---|
DREM_FastLogistic2()
Empty constructor |
|
DREM_FastLogistic2(int[][] traindataindex,
int[][] traindata,
int[][] traindataTFindex,
int[][] traindataTF,
int[] y,
double[] dtrainweight,
int numclasses,
int numbits)
Constructor where the training weights of the instances are given |
|
DREM_FastLogistic2(int[][] traindataindex,
int[][] traindata,
int[][] traindataTFindex,
int[][] traindataTF,
int[] y,
int numclasses,
double[] dcoeff,
int numbits)
Constructor where the coefficients are given to the classifier |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clones the classifier |
void |
computeG(int nel,
boolean bnew,
boolean bfirsttime)
Updates the G parameters in the multi-class case bnew means the coefficient changed on the previous coordinate or first time if didn't change then can keep previous errors just update current coefficient bfirsttime means it is the first pass through the coeffienients |
void |
computeGbin(int nel,
boolean bnew,
boolean bfirsttime)
Updates the value of the G matrix for the binary case bnew means the coefficient changed on the previous coordinate or first time If didn't change then can keep previous errors just update current coefficient bfirsttime means it is the first pass through the coefficients |
double[] |
distributionForInstance(int[] theInstance,
int nrow)
Returns a probability distribution the classifier gives to each class for the provided instance |
double[] |
distributionForInstance(int[] theInstanceIndex,
int[] theInstance,
int nrow)
Returns a probability distribution the classifier gives to each class for the provided instance |
boolean |
nextw(int nel,
boolean bnew,
boolean bfirst)
For the multi-class case updates the value of dcoeff[nel] |
boolean |
nextwbin(int nel,
boolean bnew,
boolean bfirst)
For the binary case updates the value of dcoeff[nel] |
double |
p(int nindicator,
int nrow)
Computes the probability of the item in nrow is of class nindicator |
void |
reinit(int[][] traindataindex,
int[][] traindata,
int[][] traindataTFindex,
int[][] traindataTF,
int[] y,
double[] dtrainweight,
int numclasses)
Reinitialized the variables of the classifier based on the input parameters |
java.lang.String |
saveClassifier(java.lang.String[] tfNames)
Returns a string with the classifier parameters |
void |
setRidge(double dridge)
Sets the value of the ridge parameter |
double |
soft(double da,
double ddelta)
If abs(da)-ddelta less than or equal to 0 returns 0 otherwise if da is non-negative returns abs(da)-ddelta and otherwide returns -(abs(da)-ddelta) |
java.lang.String |
toString()
Convers the classifier into a string |
void |
train()
Calss either trainbin or trainmulti to train the parameters of the classifier |
void |
trainbin()
Trains the parameters in the binary case |
void |
trainmulti()
Trains the parameters in the multi-class case |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DREM_FastLogistic2()
public DREM_FastLogistic2(int[][] traindataindex, int[][] traindata, int[][] traindataTFindex, int[][] traindataTF, int[] y, int numclasses, double[] dcoeff, int numbits)
public DREM_FastLogistic2(int[][] traindataindex, int[][] traindata, int[][] traindataTFindex, int[][] traindataTF, int[] y, double[] dtrainweight, int numclasses, int numbits)
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public void setRidge(double dridge)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String saveClassifier(java.lang.String[] tfNames)
public void reinit(int[][] traindataindex, int[][] traindata, int[][] traindataTFindex, int[][] traindataTF, int[] y, double[] dtrainweight, int numclasses)
public double soft(double da, double ddelta)
public double p(int nindicator, int nrow)
public void computeG(int nel, boolean bnew, boolean bfirsttime)
public void computeGbin(int nel, boolean bnew, boolean bfirsttime)
public boolean nextw(int nel, boolean bnew, boolean bfirst)
public boolean nextwbin(int nel, boolean bnew, boolean bfirst)
public double[] distributionForInstance(int[] theInstance, int nrow)
public double[] distributionForInstance(int[] theInstanceIndex, int[] theInstance, int nrow)
public void train()
public void trainmulti()
public void trainbin()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |