|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.AbstractClassifier
weka.classifiers.functions.LibLINEAR
public class LibLINEAR
A wrapper class for the liblinear tools (the liblinear classes, typically the jar file, need to be in the classpath to use this classifier).
Rong-En Fan, Kai-Wei Chang, Cho-Jui Hsieh, Xiang-Rui Wang, Chih-Jen Lin (2008). LIBLINEAR - A Library for Large Linear Classification. URL http://www.csie.ntu.edu.tw/~cjlin/liblinear/.
@misc{Fan2008, author = {Rong-En Fan and Kai-Wei Chang and Cho-Jui Hsieh and Xiang-Rui Wang and Chih-Jen Lin}, note = {The Weka classifier works with version 1.33 of LIBLINEAR}, title = {LIBLINEAR - A Library for Large Linear Classification}, year = {2008}, URL = {http://www.csie.ntu.edu.tw/\~cjlin/liblinear/} }Valid options are:
-S <int> Set type of solver (default: 1) 0 = L2-regularized logistic regression 1 = L2-loss support vector machines (dual) 2 = L2-loss support vector machines (primal) 3 = L1-loss support vector machines (dual) 4 = multi-class support vector machines by Crammer and Singer
-C <double> Set the cost parameter C (default: 1)
-Z Turn on normalization of input data (default: off)
-N Turn on nominal to binary conversion.
-M Turn off missing value replacement. WARNING: use only if your data has no missing values.
-P Use probability estimation (default: off) currently for L2-regularized logistic regression only!
-E <double> Set tolerance of termination criterion (default: 0.01)
-W <double> Set the parameters C of class i to weight[i]*C (default: 1)
-B <double> Add Bias term with the given value if >= 0; if < 0, no bias term added (default: 1)
-D If set, classifier is run in debug mode and may output additional info to the console
Field Summary | |
---|---|
static int |
SVMTYPE_L1LOSS_SVM_DUAL
SVM solver type L1-loss support vector machines (dual) |
static int |
SVMTYPE_L2_LR
SVM solver type L2-regularized logistic regression |
static int |
SVMTYPE_L2LOSS_SVM
SVM solver type L2-loss support vector machines (primal) |
static int |
SVMTYPE_L2LOSS_SVM_DUAL
SVM solver type L2-loss support vector machines (dual) |
static int |
SVMTYPE_MCSVM_CS
SVM solver type multi-class support vector machines by Crammer and Singer |
static Tag[] |
TAGS_SVMTYPE
SVM solver types |
Constructor Summary | |
---|---|
LibLINEAR()
|
Method Summary | |
---|---|
java.lang.String |
biasTipText()
Returns the tip text for this property |
void |
buildClassifier(Instances insts)
builds the classifier |
java.lang.String |
convertNominalToBinaryTipText()
Returns the tip text for this property |
java.lang.String |
costTipText()
Returns the tip text for this property |
double[] |
distributionForInstance(Instance instance)
Computes the distribution for a given instance. |
java.lang.String |
doNotReplaceMissingValuesTipText()
Returns the tip text for this property |
java.lang.String |
epsTipText()
Returns the tip text for this property |
double |
getBias()
Returns bias term value (default 1) No bias term is added if value < 0 |
Capabilities |
getCapabilities()
Returns default capabilities of the classifier. |
boolean |
getConvertNominalToBinary()
Gets whether conversion of nominal to binary is turned on. |
double |
getCost()
Returns the cost parameter C |
boolean |
getDoNotReplaceMissingValues()
Gets whether automatic replacement of missing values is disabled. |
double |
getEps()
Gets tolerance of termination criterion |
java.lang.Object |
getModel()
|
boolean |
getNormalize()
whether to normalize input data |
java.lang.String[] |
getOptions()
Returns the current options |
boolean |
getProbabilityEstimates()
Sets whether to generate probability estimates instead of -1/+1 for classification problems. |
java.lang.String |
getRevision()
Returns the revision string. |
SelectedTag |
getSVMType()
Gets type of SVM |
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 |
getWeights()
Gets the parameters C of class i to weight[i]*C (default 1). |
java.lang.String |
globalInfo()
Returns a string describing classifier |
static boolean |
isPresent()
returns whether the liblinear classes are present or not, i.e. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] args)
Main method for testing this class. |
java.lang.String |
normalizeTipText()
Returns the tip text for this property |
java.lang.String |
probabilityEstimatesTipText()
Returns the tip text for this property |
void |
setBias(double value)
Sets bias term value (default 1) No bias term is added if value < 0 |
void |
setConvertNominalToBinary(boolean b)
Whether to turn on conversion of nominal attributes to binary. |
void |
setCost(double value)
Sets the cost parameter C (default 1) |
void |
setDoNotReplaceMissingValues(boolean b)
Whether to turn off automatic replacement of missing values. |
void |
setEps(double value)
Sets tolerance of termination criterion (default 0.001) |
void |
setNormalize(boolean value)
whether to normalize input data |
void |
setOptions(java.lang.String[] options)
Sets the classifier options Valid options are: |
void |
setProbabilityEstimates(boolean value)
Returns whether probability estimates are generated instead of -1/+1 for classification problems. |
void |
setSVMType(SelectedTag value)
Sets type of SVM (default SVMTYPE_L2) |
void |
setWeights(java.lang.String weightsStr)
Sets the parameters C of class i to weight[i]*C (default 1). |
java.lang.String |
SVMTypeTipText()
Returns the tip text for this property |
java.lang.String |
toString()
returns a string representation |
java.lang.String |
weightsTipText()
Returns the tip text for this property |
Methods inherited from class weka.classifiers.AbstractClassifier |
---|
classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SVMTYPE_L2_LR
public static final int SVMTYPE_L2LOSS_SVM_DUAL
public static final int SVMTYPE_L2LOSS_SVM
public static final int SVMTYPE_L1LOSS_SVM_DUAL
public static final int SVMTYPE_MCSVM_CS
public static final Tag[] TAGS_SVMTYPE
Constructor Detail |
---|
public LibLINEAR()
Method Detail |
---|
public java.lang.Object getModel()
public java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation
in interface TechnicalInformationHandler
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class AbstractClassifier
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-S <int> Set type of solver (default: 1) 0 = L2-regularized logistic regression 1 = L2-loss support vector machines (dual) 2 = L2-loss support vector machines (primal) 3 = L1-loss support vector machines (dual) 4 = multi-class support vector machines by Crammer and Singer
-C <double> Set the cost parameter C (default: 1)
-Z Turn on normalization of input data (default: off)
-N Turn on nominal to binary conversion.
-M Turn off missing value replacement. WARNING: use only if your data has no missing values.
-P Use probability estimation (default: off) currently for L2-regularized logistic regression only!
-E <double> Set tolerance of termination criterion (default: 0.01)
-W <double> Set the parameters C of class i to weight[i]*C (default: 1)
-B <double> Add Bias term with the given value if >= 0; if < 0, no bias term added (default: 1)
-D If set, classifier is run in debug mode and may output additional info to the console
setOptions
in interface OptionHandler
setOptions
in class AbstractClassifier
options
- the options to parse
java.lang.Exception
- if parsing failspublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class AbstractClassifier
public static boolean isPresent()
public void setSVMType(SelectedTag value)
value
- the type of the SVMpublic SelectedTag getSVMType()
public java.lang.String SVMTypeTipText()
public void setCost(double value)
value
- the cost valuepublic double getCost()
public java.lang.String costTipText()
public void setEps(double value)
value
- the tolerancepublic double getEps()
public java.lang.String epsTipText()
public void setBias(double value)
value
- the bias term valuepublic double getBias()
public java.lang.String biasTipText()
public java.lang.String normalizeTipText()
public void setNormalize(boolean value)
value
- whether to normalize the datapublic boolean getNormalize()
public java.lang.String convertNominalToBinaryTipText()
public void setConvertNominalToBinary(boolean b)
b
- true if nominal to binary conversion is to be
turned onpublic boolean getConvertNominalToBinary()
public java.lang.String doNotReplaceMissingValuesTipText()
public void setDoNotReplaceMissingValues(boolean b)
b
- true if automatic missing values replacement is
to be disabled.public boolean getDoNotReplaceMissingValues()
public void setWeights(java.lang.String weightsStr)
weightsStr
- the weights (doubles, separated by blanks)public java.lang.String getWeights()
public java.lang.String weightsTipText()
public void setProbabilityEstimates(boolean value)
value
- whether to predict probabilitiespublic boolean getProbabilityEstimates()
public java.lang.String probabilityEstimatesTipText()
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in interface Classifier
distributionForInstance
in class AbstractClassifier
instance
- the instance for which distribution is computed
java.lang.Exception
- if the distribution can't be computed successfullypublic Capabilities getCapabilities()
getCapabilities
in interface Classifier
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class AbstractClassifier
Capabilities
public void buildClassifier(Instances insts) throws java.lang.Exception
buildClassifier
in interface Classifier
insts
- the training instances
java.lang.Exception
- if liblinear classes not in classpath or liblinear
encountered a problempublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class AbstractClassifier
public static void main(java.lang.String[] args)
args
- the options
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |