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
MaltLiblinearModel
public MaltLiblinearModel(int[] labels,
int nr_class,
int nr_feature,
double[][] w,
de.bwaldvogel.liblinear.SolverType solverType)
MaltLiblinearModel
public MaltLiblinearModel(Reader inputReader)
throws IOException
- Throws:
IOException
MaltLiblinearModel
public MaltLiblinearModel(File modelFile)
throws IOException
- Throws:
IOException
getNrClass
public int getNrClass()
- Returns:
- number of classes
getNrFeature
public int getNrFeature()
- Returns:
- number of features
getLabels
public int[] getLabels()
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
Copyright 2007-2012 Johan Hall, Jens Nilsson and Joakim Nivre.