public final class Model
extends java.lang.Object
implements java.io.Serializable
Model stores the model obtained from the training procedure
use Linear.loadModel(File) and Linear.saveModel(File, Model) to load/save it
| Constructor and Description |
|---|
Model() |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
equals(double[] a,
double[] a2)
don't use
Arrays.equals(double[], double[]) here, cause 0.0 and -0.0 should be handled the same |
boolean |
equals(java.lang.Object obj) |
double |
getBias() |
double |
getDecfunBias(int labelIdx)
This function gives the bias term corresponding to the class with the
label_idx.
|
double |
getDecfunCoef(int featIdx,
int labelIdx)
This function gives the coefficient for the feature with feature index =
feat_idx and the class with label index = label_idx.
|
double[] |
getFeatureWeights()
The array w gives feature weights; its size is
nr_feature*nr_class but is nr_feature if nr_class = 2.
|
int[] |
getLabels() |
int |
getNrClass() |
int |
getNrFeature() |
SolverType |
getSolverType() |
int |
hashCode() |
boolean |
isProbabilityModel() |
static Model |
load(java.io.File file)
|
static Model |
load(java.io.Reader inputReader)
|
void |
save(java.io.File file)
|
void |
save(java.io.Writer writer)
|
java.lang.String |
toString() |
public int getNrClass()
public int getNrFeature()
public int[] getLabels()
public SolverType getSolverType()
public double[] getFeatureWeights()
+------------------+------------------+------------+ | 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.
getBias()public boolean isProbabilityModel()
public double getBias()
getFeatureWeights()public double getDecfunCoef(int featIdx,
int labelIdx)
public double getDecfunBias(int labelIdx)
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectprotected static boolean equals(double[] a,
double[] a2)
Arrays.equals(double[], double[]) here, cause 0.0 and -0.0 should be handled the sameLinear.saveModel(java.io.Writer, Model)public void save(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic void save(java.io.Writer writer)
throws java.io.IOException
java.io.IOExceptionpublic static Model load(java.io.File file) throws java.io.IOException
java.io.IOExceptionpublic static Model load(java.io.Reader inputReader) throws java.io.IOException
java.io.IOException