|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--weka.classifiers.Classifier
|
+--weka.classifiers.DistributionClassifier
|
+--weka.classifiers.Logistic
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.
| Field Summary | |
protected int |
m_ClassIndex
The index of the class attribute |
protected boolean |
m_Debug
Debugging output |
protected double |
m_LL
The log-likelihood of the built model |
protected double |
m_LLn
The log-likelihood of the null model |
protected int |
m_NumPredictors
The number of attributes in the model |
protected double[] |
m_Par
The coefficients of the model |
protected double |
m_Ridge
The ridge parameter. |
| Constructor Summary | |
Logistic()
|
|
| Method Summary | |
void |
buildClassifier(Instances train)
Builds the classifier |
protected double |
calculateLogLikelihood(double[][] X,
double[] Y,
Matrix jacobian,
double[] deltas)
Calculates the log likelihood of the current set of coefficients (stored in m_Par), given the data. |
double[] |
distributionForInstance(Instance instance)
Computes the distribution for a given instance |
protected double |
evaluateProbability(double[] instDat)
Evaluate the probability for this point using the current coefficients |
boolean |
getDebug()
Gets whether debugging output will be printed. |
java.lang.String[] |
getOptions()
Gets the current settings of the classifier. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
void |
lnsrch(int n,
double[] xold,
double fold,
double[] g,
double[] p,
double[] x,
double stpmax,
double[][] X,
double[] Y)
Finds a new point x in the direction p from a point xold at which the value of the function has decreased sufficiently. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
protected static double |
Norm(double z)
Returns probability. |
void |
setDebug(boolean debug)
Sets whether debugging output will be printed. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString()
Gets a string describing the classifier. |
| Methods inherited from class weka.classifiers.DistributionClassifier |
classifyInstance |
| Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected double m_LL
protected double m_LLn
protected double[] m_Par
protected int m_NumPredictors
protected int m_ClassIndex
protected double m_Ridge
protected boolean m_Debug
| Constructor Detail |
public Logistic()
| Method Detail |
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
n - number of variablesxold - old pointfold - value at that pointg - gtradient at that pointp - directionx - new value along direction p from xoldstpmax - maximum step lengthX - instance dataY - class valuesjava.lang.Exception - if an error occursprotected static double Norm(double z)
protected double evaluateProbability(double[] instDat)
instDat - the instance data
protected double calculateLogLikelihood(double[][] X,
double[] Y,
Matrix jacobian,
double[] deltas)
X - the instance dataY - the class values for each instancejacobian - the matrix which will contain the jacobian matrix after
the method returnsdeltas - an array which will contain the parameter adjustments after
the method returnspublic java.util.Enumeration listOptions()
listOptions in interface OptionHandler
public void setOptions(java.lang.String[] options)
throws java.lang.Exception
-D
Turn on debugging output.
setOptions in interface OptionHandleroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlerpublic void setDebug(boolean debug)
debug - true if debugging output should be printedpublic boolean getDebug()
public void buildClassifier(Instances train)
throws java.lang.Exception
buildClassifier in class Classifierdata - the training data to be used for generating the
boosted classifier.java.lang.Exception - if the classifier could not be built successfully
public double[] distributionForInstance(Instance instance)
throws java.lang.Exception
distributionForInstance in class DistributionClassifierinstance - the instance for which distribution is computedjava.lang.Exception - if the distribution can't be computed successfullypublic java.lang.String toString()
toString in class java.lang.Objectpublic 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: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||