public class Logistic extends java.lang.Object implements OptionHandler, WeightedInstancesHandler, TechnicalInformationHandler
@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).
Modifier and Type | Field and Description |
---|---|
protected int |
m_ClassIndex
The index of the class attribute
|
protected double[][] |
m_Data
The data saved as a matrix
|
protected boolean |
m_Debug
Debugging output
|
protected double |
m_LL
Log-likelihood of the searched model
|
protected int |
m_NumClasses
The number of the class labels
|
protected int |
m_NumPredictors
The number of attributes in the model
|
protected double[][] |
m_Par
The coefficients (optimized parameters) of the model
|
protected double |
m_Ridge
The ridge parameter.
|
Constructor and Description |
---|
Logistic()
Default constructor
|
Logistic(java.lang.String fileParam)
Creates a new instance of Logistic with a file parameter of KEEL format
|
Modifier and Type | Method and Description |
---|---|
void |
buildClassifier(InstanceSet train)
Builds the classifier
|
void |
buildClassifier(InstanceSet train,
InstanceAttributes ats)
Builds the classifier
|
java.lang.String |
debugTipText()
Returns the tip text for this property
|
double[] |
distributionForInstance(double[] values)
Computes the distribution for a given instance
|
double[] |
distributionForInstance(Instance instance)
Computes the distribution for a given instance
|
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
|
java.lang.String |
maxItsTipText()
Returns the tip text for this property
|
java.lang.String |
ridgeTipText()
Returns the tip text for this property
|
void |
runModel()
Main method for running this class.
|
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.
|
static void |
writeOutput(java.lang.String fileName,
java.lang.String[] instancesIN,
java.lang.String[] instancesOUT,
Attribute[] inputs,
Attribute output,
int nInputs,
java.lang.String relation)
Creates the output file in KEEL format of this method
|
protected double[][] m_Par
protected double[][] m_Data
protected int m_NumPredictors
protected int m_ClassIndex
protected int m_NumClasses
protected double m_Ridge
protected boolean m_Debug
protected double m_LL
public Logistic(java.lang.String fileParam)
fileParam
- The path to the configuration file with all the parameters in KEEL formatpublic Logistic()
Default constructor
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
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
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public java.lang.String debugTipText()
public void setDebug(boolean debug)
debug
- true if debugging output should be printedpublic boolean getDebug()
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 void buildClassifier(InstanceSet train) throws java.lang.Exception
train
- the training data to be used for generating the
boosted classifier.java.lang.Exception
- if the classifier could not be built successfullypublic void buildClassifier(InstanceSet train, InstanceAttributes ats) throws java.lang.Exception
train
- the training data to be used for generating the
boosted classifier.ats
- The attributes of the train InstanceSet (non-static)java.lang.Exception
- if the classifier could not be built successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
instance
- the instance for which distribution is computedjava.lang.Exception
- if the distribution can't be computed successfullypublic double[] distributionForInstance(double[] values) throws java.lang.Exception
values
- the real-coded values of the instancejava.lang.Exception
- if the distribution can't be computed successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public void runModel()
public static void writeOutput(java.lang.String fileName, java.lang.String[] instancesIN, java.lang.String[] instancesOUT, Attribute[] inputs, Attribute output, int nInputs, java.lang.String relation)
fileName
- Name of the content fileinstancesIN
- Vector with the original output valuesinstancesOUT
- Vector the predicted output valuesinputs
- Input Attributesoutput
- Output AttributenInputs
- Number of Inputs Attributesrelation
- Name of the data set