public class LibLINEAR
extends weka.classifiers.AbstractClassifier
implements weka.core.TechnicalInformationHandler
@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)
for multi-class classification
0 -- L2-regularized logistic regression (primal)
1 -- L2-regularized L2-loss support vector classification (dual)
2 -- L2-regularized L2-loss support vector classification (primal)
3 -- L2-regularized L1-loss support vector classification (dual)
4 -- support vector classification by Crammer and Singer
5 -- L1-regularized L2-loss support vector classification
6 -- L1-regularized logistic regression
7 -- L2-regularized logistic regression (dual)
for regression
11 -- L2-regularized L2-loss support vector regression (primal)
12 -- L2-regularized L2-loss support vector regression (dual)
13 -- L2-regularized L1-loss support vector regression (dual)
-C <double> Set the cost parameter C (default: 1)
-Z Turn on normalization of input data (default: off)
-L <double> The epsilon parameter in epsilon-insensitive loss function. (default 0.1)
-I <int> The maximum number of iterations to perform. (default 0.1)
-P Use probability estimation (default: off) currently for L2-regularized logistic regression only!
-E <double> Set tolerance of termination criterion (default: 0.001)
-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
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
REVISION |
static weka.core.Tag[] |
TAGS_SVMTYPE
SVM solver types
|
| Constructor and Description |
|---|
LibLINEAR() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
biasTipText()
Returns the tip text for this property
|
void |
buildClassifier(weka.core.Instances insts)
builds the classifier
|
java.lang.String |
costTipText()
Returns the tip text for this property
|
double[] |
distributionForInstance(weka.core.Instance instance)
Computes the distribution for a given instance.
|
java.lang.String |
epsilonParameterTipText()
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
|
weka.core.Capabilities |
getCapabilities()
Returns default capabilities of the classifier.
|
double |
getCost()
Returns the cost parameter C
|
double |
getEps()
Gets tolerance of termination criterion
|
double |
getEpsilonParameter()
Get the value of epsilon parameter of the epsilon insensitive loss
function.
|
int |
getMaximumNumberOfIterations()
Get the number of iterations to perform.
|
de.bwaldvogel.liblinear.Model |
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.
|
weka.core.SelectedTag |
getSVMType()
Gets type of SVM
|
weka.core.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
|
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 |
maximumNumberOfIterationsTipText()
Returns the tip text for this property
|
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 |
setCost(double value)
Sets the cost parameter C (default 1)
|
void |
setEps(double value)
Sets tolerance of termination criterion (default 0.001)
|
void |
setEpsilonParameter(double v)
Set the value of epsilon parameter of the epsilon insensitive loss
function.
|
void |
setMaximumNumberOfIterations(int v)
Set the number of iterations to perform.
|
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(weka.core.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
|
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlacespublic static final java.lang.String REVISION
public static final weka.core.Tag[] TAGS_SVMTYPE
public de.bwaldvogel.liblinear.Model getModel()
public java.lang.String globalInfo()
public weka.core.TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface weka.core.TechnicalInformationHandlerpublic java.util.Enumeration listOptions()
listOptions in interface weka.core.OptionHandlerlistOptions in class weka.classifiers.AbstractClassifierpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-S <int>
Set type of solver (default: 1)
for multi-class classification
0 -- L2-regularized logistic regression (primal)
1 -- L2-regularized L2-loss support vector classification (dual)
2 -- L2-regularized L2-loss support vector classification (primal)
3 -- L2-regularized L1-loss support vector classification (dual)
4 -- support vector classification by Crammer and Singer
5 -- L1-regularized L2-loss support vector classification
6 -- L1-regularized logistic regression
7 -- L2-regularized logistic regression (dual)
for regression
11 -- L2-regularized L2-loss support vector regression (primal)
12 -- L2-regularized L2-loss support vector regression (dual)
13 -- L2-regularized L1-loss support vector regression (dual)
-C <double> Set the cost parameter C (default: 1)
-Z Turn on normalization of input data (default: off)
-L <double> The epsilon parameter in epsilon-insensitive loss function. (default 0.1)
-I <int> The maximum number of iterations to perform. (default 0.1)
-P Use probability estimation (default: off) currently for L2-regularized logistic regression only!
-E <double> Set tolerance of termination criterion (default: 0.001)
-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 weka.core.OptionHandlersetOptions in class weka.classifiers.AbstractClassifieroptions - the options to parsejava.lang.Exception - if parsing failspublic java.lang.String[] getOptions()
getOptions in interface weka.core.OptionHandlergetOptions in class weka.classifiers.AbstractClassifierpublic void setSVMType(weka.core.SelectedTag value)
value - the type of the SVMpublic weka.core.SelectedTag getSVMType()
public java.lang.String SVMTypeTipText()
public double getEpsilonParameter()
public void setEpsilonParameter(double v)
v - Value to assign to epsilon parameter.public java.lang.String epsilonParameterTipText()
public int getMaximumNumberOfIterations()
public void setMaximumNumberOfIterations(int v)
v - the number of iterations to perform.public java.lang.String maximumNumberOfIterationsTipText()
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 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(weka.core.Instance instance)
throws java.lang.Exception
distributionForInstance in interface weka.classifiers.ClassifierdistributionForInstance in class weka.classifiers.AbstractClassifierinstance - the instance for which distribution is computedjava.lang.Exception - if the distribution can't be computed successfullypublic weka.core.Capabilities getCapabilities()
getCapabilities in interface weka.classifiers.ClassifiergetCapabilities in interface weka.core.CapabilitiesHandlergetCapabilities in class weka.classifiers.AbstractClassifierpublic void buildClassifier(weka.core.Instances insts)
throws java.lang.Exception
buildClassifier in interface weka.classifiers.Classifierinsts - the training instancesjava.lang.Exception - if liblinear classes not in classpath or liblinear
encountered a problempublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getRevision()
getRevision in interface weka.core.RevisionHandlergetRevision in class weka.classifiers.AbstractClassifierpublic static void main(java.lang.String[] args)
args - the options