LibLINEAR

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.functions
Class LibLINEAR

    java.lang.Object
      weka.classifiers.Classifier
          weka.classifiers.functions.LibLINEAR

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler, TechnicalInformationHandler

    public class LibLINEAR

extends Classifier
implements TechnicalInformationHandler

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/.

BibTeX:

     @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

Version:
  $Revision: 4856 $
Author:
  Benedikt Waldvogel (mail at bwaldvogel.de)
See Also:
  Serialized Form

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.Classifier
`classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### SVMTYPE_L2_LR

    public static final int SVMTYPE_L2_LR

  SVM solver type L2-regularized logistic regression

  See Also:
    Constant Field Values

### SVMTYPE_L2LOSS_SVM_DUAL

    public static final int SVMTYPE_L2LOSS_SVM_DUAL

  SVM solver type L2-loss support vector machines (dual)

  See Also:
    Constant Field Values

### SVMTYPE_L2LOSS_SVM

    public static final int SVMTYPE_L2LOSS_SVM

  SVM solver type L2-loss support vector machines (primal)

  See Also:
    Constant Field Values

### SVMTYPE_L1LOSS_SVM_DUAL

    public static final int SVMTYPE_L1LOSS_SVM_DUAL

  SVM solver type L1-loss support vector machines (dual)

  See Also:
    Constant Field Values

### SVMTYPE_MCSVM_CS

    public static final int SVMTYPE_MCSVM_CS

  SVM solver type multi-class support vector machines by Crammer and Singer

  See Also:
    Constant Field Values

### TAGS_SVMTYPE

    public static final Tag[] TAGS_SVMTYPE

  SVM solver types

Constructor Detail

### LibLINEAR

    public LibLINEAR()

Method Detail

### getModel

    public java.lang.Object getModel()

### globalInfo

    public java.lang.String globalInfo()

  Returns a string describing classifier

  Returns:
    a description suitable for displaying in the explorer/experimenter gui

### getTechnicalInformation

    public 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.

  Specified by:
    `getTechnicalInformation` in interface `TechnicalInformationHandler`
  Returns:
    the technical information about this class

### listOptions

    public java.util.Enumeration listOptions()

  Returns an enumeration describing the available options.

  Specified by:
    `listOptions` in interface `OptionHandler`
  Overrides:
    `listOptions` in class `Classifier`
  Returns:
    an enumeration of all the available options.

### setOptions

    public void setOptions(java.lang.String[] options)
                    throws java.lang.Exception

  Sets the classifier options

  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

  Specified by:
    `setOptions` in interface `OptionHandler`
  Overrides:
    `setOptions` in class `Classifier`
  Parameters:
    `options` - the options to parse
  Throws:
    `java.lang.Exception` - if parsing fails

### getOptions

    public java.lang.String[] getOptions()

  Returns the current options

  Specified by:
    `getOptions` in interface `OptionHandler`
  Overrides:
    `getOptions` in class `Classifier`
  Returns:
    the current setup

### isPresent

    public static boolean isPresent()

  returns whether the liblinear classes are present or not, i.e. whether the classes are in the classpath or not

  Returns:
    whether the liblinear classes are available

### setSVMType

    public void setSVMType(SelectedTag value)

  Sets type of SVM (default SVMTYPE_L2)

  Parameters:
    `value` - the type of the SVM

### getSVMType

    public SelectedTag getSVMType()

  Gets type of SVM

  Returns:
    the type of the SVM

### SVMTypeTipText

    public java.lang.String SVMTypeTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setCost

    public void setCost(double value)

  Sets the cost parameter C (default 1)

  Parameters:
    `value` - the cost value

### getCost

    public double getCost()

  Returns the cost parameter C

  Returns:
    the cost value

### costTipText

    public java.lang.String costTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setEps

    public void setEps(double value)

  Sets tolerance of termination criterion (default 0.001)

  Parameters:
    `value` - the tolerance

### getEps

    public double getEps()

  Gets tolerance of termination criterion

  Returns:
    the current tolerance

### epsTipText

    public java.lang.String epsTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setBias

    public void setBias(double value)

  Sets bias term value (default 1) No bias term is added if value < 0

  Parameters:
    `value` - the bias term value

### getBias

    public double getBias()

  Returns bias term value (default 1) No bias term is added if value < 0

  Returns:
    the bias term value

### biasTipText

    public java.lang.String biasTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### normalizeTipText

    public java.lang.String normalizeTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setNormalize

    public void setNormalize(boolean value)

  whether to normalize input data

  Parameters:
    `value` - whether to normalize the data

### getNormalize

    public boolean getNormalize()

  whether to normalize input data

  Returns:
    true, if the data is normalized

### convertNominalToBinaryTipText

    public java.lang.String convertNominalToBinaryTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setConvertNominalToBinary

    public void setConvertNominalToBinary(boolean b)

  Whether to turn on conversion of nominal attributes to binary.

  Parameters:
    `b` - true if nominal to binary conversion is to be turned on

### getConvertNominalToBinary

    public boolean getConvertNominalToBinary()

  Gets whether conversion of nominal to binary is turned on.

  Returns:
    true if nominal to binary conversion is turned on.

### doNotReplaceMissingValuesTipText

    public java.lang.String doNotReplaceMissingValuesTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setDoNotReplaceMissingValues

    public void setDoNotReplaceMissingValues(boolean b)

  Whether to turn off automatic replacement of missing values. Set to true only if the data does not contain missing values.

  Parameters:
    `b` - true if automatic missing values replacement is to be disabled.

### getDoNotReplaceMissingValues

    public boolean getDoNotReplaceMissingValues()

  Gets whether automatic replacement of missing values is disabled.

  Returns:
    true if automatic replacement of missing values is disabled.

### setWeights

    public void setWeights(java.lang.String weightsStr)

  Sets the parameters C of class i to weight[i]*C (default 1). Blank separated list of doubles.

  Parameters:
    `weightsStr` - the weights (doubles, separated by blanks)

### getWeights

    public java.lang.String getWeights()

  Gets the parameters C of class i to weight[i]*C (default 1). Blank separated doubles.

  Returns:
    the weights (doubles separated by blanks)

### weightsTipText

    public java.lang.String weightsTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### setProbabilityEstimates

    public void setProbabilityEstimates(boolean value)

  Returns whether probability estimates are generated instead of -1/+1 for classification problems.

  Parameters:
    `value` - whether to predict probabilities

### getProbabilityEstimates

    public boolean getProbabilityEstimates()

  Sets whether to generate probability estimates instead of -1/+1 for classification problems.

  Returns:
    true, if probability estimates should be returned

### probabilityEstimatesTipText

    public java.lang.String probabilityEstimatesTipText()

  Returns the tip text for this property

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### distributionForInstance

    public double[] distributionForInstance(Instance instance)
                                     throws java.lang.Exception

  Computes the distribution for a given instance.

  Overrides:
    `distributionForInstance` in class `Classifier`
  Parameters:
    `instance` - the instance for which distribution is computed
  Returns:
    the distribution
  Throws:
    `java.lang.Exception` - if the distribution can't be computed successfully

### getCapabilities

    public Capabilities getCapabilities()

  Returns default capabilities of the classifier.

  Specified by:
    `getCapabilities` in interface `CapabilitiesHandler`
  Overrides:
    `getCapabilities` in class `Classifier`
  Returns:
    the capabilities of this classifier
  See Also:
    `Capabilities`

### buildClassifier

    public void buildClassifier(Instances insts)
                         throws java.lang.Exception

  builds the classifier

  Specified by:
    `buildClassifier` in class `Classifier`
  Parameters:
    `insts` - the training instances
  Throws:
    `java.lang.Exception` - if liblinear classes not in classpath or liblinear encountered a problem

### toString

    public java.lang.String toString()

  returns a string representation

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a string representation

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Returns:
    the revision

### main

    public static void main(java.lang.String[] args)

  Main method for testing this class.

  Parameters:
    `args` - the options

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD