All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.Logistic

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.DistributionClassifier
                    |
                    +----weka.classifiers.Logistic

public class Logistic
extends DistributionClassifier
implements OptionHandler
Class for building and using a two-class logistic regression model with a ridge estimator.

This class utilizes globally convergent Newtons Method adapted from Numerical Recipies in C. Reference: le Cessie, S. and van Houwelingen, J.C. (1997). Ridge Estimators in Logistic Regression. Applied Statistics, Vol. 41, No. 1, pp. 191-201.

Missing values are replaced using a ReplaceMissingValuesFilter, and nominal attributes are transformed into numeric attributes using a NominalToBinaryFilter.

Valid options are:

-D
Turn on debugging output.

Version:
$Revision: 1.12.2.1 $
Author:
Len Trigg (trigg@cs.waikato.ac.nz)
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)
Author:
Tony Voyle (tv6@cs.waikato.ac.nz)

Constructor Index

 o Logistic()
 

Method Index

 o buildClassifier(Instances)
Builds the classifier
 o distributionForInstance(Instance)
Computes the distribution for a given instance
 o getDebug()
Gets whether debugging output will be printed.
 o getOptions()
Gets the current settings of the classifier.
 o listOptions()
Returns an enumeration describing the available options
 o lnsrch(int, double[], double, double[], double[], double[], double, double[][], double[])
Finds a new point x in the direction p from a point xold at which the value of the function has decreased sufficiently.
 o main(String[])
Main method for testing this class.
 o setDebug(boolean)
Sets whether debugging output will be printed.
 o setOptions(String[])
Parses a given list of options.
 o toString()
Gets a string describing the classifier.

Constructor Detail

 o Logistic
public Logistic()

Method Detail

 o lnsrch
public void lnsrch(int n,
                   double xold[],
                   double fold,
                   double g[],
                   double p[],
                   double x[],
                   double stpmax,
                   double X[][],
                   double Y[]) throws java.lang.Exception
          Finds a new point x in the direction p from a point xold at which the value of the function has decreased sufficiently.
Parameters:
n - number of variables
xold - old point
fold - value at that point
g - gtradient at that point
p - direction
x - new value along direction p from xold
stpmax - maximum step length
X - instance data
Y - class values
Throws:
java.lang.Exception - if an error occurs
 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
Returns:
an enumeration of all the available options
 o setOptions
public void setOptions(java.lang.String options[]) throws java.lang.Exception
          Parses a given list of options. Valid options are:

-D
Turn on debugging output.

Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
 o getOptions
public java.lang.String[] getOptions()
          Gets the current settings of the classifier.
Returns:
an array of strings suitable for passing to setOptions
 o setDebug
public void setDebug(boolean debug)
          Sets whether debugging output will be printed.
Parameters:
debug - true if debugging output should be printed
 o getDebug
public boolean getDebug()
          Gets whether debugging output will be printed.
Returns:
true if debugging output will be printed
 o buildClassifier
public void buildClassifier(Instances train) throws java.lang.Exception
          Builds the classifier
Parameters:
data - the training data to be used for generating the boosted classifier.
Throws:
java.lang.Exception - if the classifier could not be built successfully
Overrides:
buildClassifier in class Classifier
 o distributionForInstance
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
          Computes the distribution for a given instance
Parameters:
instance - the instance for which distribution is computed
Returns:
the distribution
Throws:
java.lang.Exception - if the distribution can't be computed successfully
Overrides:
distributionForInstance in class DistributionClassifier
 o toString
public java.lang.String toString()
          Gets a string describing the classifier.
Returns:
a string describing the classifer built.
Overrides:
toString in class java.lang.Object
 o main
public static void main(java.lang.String argv[])
          Main method for testing this class.
Parameters:
argv - should contain the command line arguments to the scheme (see Evaluation)

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home