Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.maltparser.ml.lib
Class MaltLiblinearModel

    java.lang.Object
      org.maltparser.ml.lib.MaltLiblinearModel

All Implemented Interfaces:
  Serializable, MaltLibModel

    public class MaltLiblinearModel

extends Object
implements Serializable, MaltLibModel

This class borrows code from liblinear.Model.java of the Java implementation of the liblinear package. MaltLiblinearModel stores the model obtained from the training procedure. In addition to the original code the model is more integrated to MaltParser. Instead of moving features from MaltParser's internal data structures to liblinear's data structure it uses MaltParser's data structure directly on the model.

Author:
  Johan Hall
See Also:
  Serialized Form

Constructor Summary
`MaltLiblinearModel(File modelFile)`
`MaltLiblinearModel(liblinear.Model model, liblinear.SolverType solverType)`
`MaltLiblinearModel(Reader inputReader)`

Method Summary
`boolean` | `equals(Object obj)`
`double` | `getBias()`
`double[]` | `getFeatureWeights()` The nr_feature*nr_class array w gives feature weights.
`int[]` | `getLabels()`
`int` | `getNrClass()`
`int` | `getNrFeature()`
`int` | `hashCode()`
`boolean` | `isProbabilityModel()`
`int[]` | `predict(MaltFeatureNode[] x)`
`String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### MaltLiblinearModel

    public MaltLiblinearModel(liblinear.Model model,
                              liblinear.SolverType solverType)

### MaltLiblinearModel

    public MaltLiblinearModel(Reader inputReader)
                       throws IOException

Throws:
  `IOException`

### MaltLiblinearModel

    public MaltLiblinearModel(File modelFile)
                       throws IOException

Throws:
  `IOException`

Method Detail

### getNrClass

    public int getNrClass()

  Returns:
    number of classes

### getNrFeature

    public int getNrFeature()

  Returns:
    number of features

### getLabels

    public int[] getLabels()

### getFeatureWeights

    public double[] getFeatureWeights()

  The nr_feature*nr_class array w gives feature weights. We use one against the rest for multi-class classification, so each feature index corresponds to nr_class weight values. Weights are organized in the following way

       +------------------+------------------+------------+
       | nr_class weights | nr_class weights | ...
       | for 1st feature | for 2nd feature |
       +------------------+------------------+------------+

  If bias >= 0, x becomes [x; bias]. The number of features is increased by one, so w is a (nr_feature+1)*nr_class array. The value of bias is stored in the variable bias.

  Returns:
    a copy of the feature weight array as described
  See Also:
    `getBias()`

### isProbabilityModel

    public boolean isProbabilityModel()

  Returns:
    true for logistic regression solvers

### getBias

    public double getBias()

### predict

    public int[] predict(MaltFeatureNode[] x)

  Specified by:
    `predict` in interface `MaltLibModel`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  Overrides:
    `equals` in class `Object`

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| MaltParser 1.5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2007-2011 Johan Hall, Jens Nilsson and Joakim Nivre.