|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.functions.Logistic
public class Logistic
Class for building and using a multinomial logistic regression model with a ridge estimator.
There are some modifications, however, compared to the paper of leCessie and van Houwelingen(1992):
If there are k classes for n instances with m attributes, the parameter matrix B to be calculated will be an m*(k-1) matrix.
The probability for class j with the exception of the last class is
Pj(Xi) = exp(XiBj)/((sum[j=1..(k-1)]exp(Xi*Bj))+1)
The last class has probability
1-(sum[j=1..(k-1)]Pj(Xi))
= 1/((sum[j=1..(k-1)]exp(Xi*Bj))+1)
The (negative) multinomial log-likelihood is thus:
L = -sum[i=1..n]{
sum[j=1..(k-1)](Yij * ln(Pj(Xi)))
+(1 - (sum[j=1..(k-1)]Yij))
* ln(1 - sum[j=1..(k-1)]Pj(Xi))
} + ridge * (B^2)
In order to find the matrix B for which L is minimised, a Quasi-Newton Method is used to search for the optimized values of the m*(k-1) variables. Note that before we use the optimization procedure, we 'squeeze' the matrix B into a m*(k-1) vector. For details of the optimization procedure, please check weka.core.Optimization class.
Although original Logistic Regression does not deal with instance weights, we modify the algorithm a little bit to handle the instance weights.
For more information see:
le Cessie, S., van Houwelingen, J.C. (1992). Ridge Estimators in Logistic Regression. Applied Statistics. 41(1):191-201.
Note: Missing values are replaced using a ReplaceMissingValuesFilter, and nominal attributes are transformed into numeric attributes using a NominalToBinaryFilter.
@article{leCessie1992, author = {le Cessie, S. and van Houwelingen, J.C.}, journal = {Applied Statistics}, number = {1}, pages = {191-201}, title = {Ridge Estimators in Logistic Regression}, volume = {41}, year = {1992} }Valid options are:
-D Turn on debugging output.
-R <ridge> Set the ridge in the log-likelihood.
-M <number> Set the maximum number of iterations (default -1, until convergence).
Constructor Summary | |
---|---|
Logistic()
|
Method Summary | |
---|---|
void |
buildClassifier(Instances train)
Builds the classifier |
java.lang.String |
debugTipText()
Returns the tip text for this property |
double[] |
distributionForInstance(Instance instance)
Computes the distribution for a given instance |
Capabilities |
getCapabilities()
Returns default capabilities of the classifier. |
boolean |
getDebug()
Gets whether debugging output will be printed. |
int |
getMaxIts()
Get the value of MaxIts. |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
double |
getRidge()
Gets the ridge in the log-likelihood. |
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on. |
java.lang.String |
globalInfo()
Returns a string describing this classifier |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
java.lang.String |
maxItsTipText()
Returns the tip text for this property |
java.lang.String |
ridgeTipText()
Returns the tip text for this property |
void |
setDebug(boolean debug)
Sets whether debugging output will be printed. |
void |
setMaxIts(int newMaxIts)
Set the value of MaxIts. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setRidge(double ridge)
Sets the ridge in the log-likelihood. |
java.lang.String |
toString()
Gets a string describing the classifier. |
Methods inherited from class weka.classifiers.Classifier |
---|
classifyInstance, forName, makeCopies, makeCopy |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Logistic()
Method Detail |
---|
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class Classifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D Turn on debugging output.
-R <ridge> Set the ridge in the log-likelihood.
-M <number> Set the maximum number of iterations (default -1, until convergence).
setOptions
in interface OptionHandler
setOptions
in class Classifier
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class Classifier
public java.lang.String debugTipText()
debugTipText
in class Classifier
public void setDebug(boolean debug)
setDebug
in class Classifier
debug
- true if debugging output should be printedpublic boolean getDebug()
getDebug
in class Classifier
public java.lang.String ridgeTipText()
public void setRidge(double ridge)
ridge
- the ridgepublic double getRidge()
public java.lang.String maxItsTipText()
public int getMaxIts()
public void setMaxIts(int newMaxIts)
newMaxIts
- Value to assign to MaxIts.public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class Classifier
Capabilities
public void buildClassifier(Instances train) throws java.lang.Exception
buildClassifier
in class Classifier
train
- the training data to be used for generating the
boosted classifier.
java.lang.Exception
- if the classifier could not be built successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance for which distribution is computed
java.lang.Exception
- if the distribution can't be computed successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
argv
- should contain the command line arguments to the
scheme (see Evaluation)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |