public class BiasedWeightVector extends SparseWeightVector
SparseWeightVector class that it extends, except that this vector also
contains a bias term which is added to every dot product and affected by every vector addition
operation.| Modifier and Type | Field and Description |
|---|---|
protected double |
bias
The current bias weight.
|
protected static double |
defaultInitialBias
Default value for
initialBias. |
protected double |
initialBias
The first value for
bias. |
defaultCapacity, defaultWeight, weights| Constructor and Description |
|---|
BiasedWeightVector()
Instantiates this biased vector with default parameter values.
|
BiasedWeightVector(double b)
Instantiates this biased vector with the specified initial bias.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Empties the weight map.
|
double |
dot(int[] exampleFeatures,
double[] exampleValues,
double defaultW)
Takes the dot product of this
BiasedWeightVector with the argument vector, using
the specified default weight when one is not yet present in this vector. |
SparseWeightVector |
emptyClone()
Returns a new, empty weight vector with the same parameter settings as this one.
|
void |
read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
Reads the representation of a weight vector with this object's run-time type from the given
stream, overwriting the data in this object.
|
void |
scaledAdd(int[] exampleFeatures,
double[] exampleValues,
double factor,
double defaultW)
Self-modifying vector addition where the argument vector is first scaled by the given factor.
|
void |
write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
Writes the weight vector's internal representation in binary form.
|
void |
write(PrintStream out)
Outputs the contents of this
BiasedWeightVector into the specified
PrintStream. |
void |
write(PrintStream out,
Lexicon lex)
Outputs the contents of this
BiasedWeightVector into the specified
PrintStream. |
clone, dot, getWeight, getWeight, pairwiseMultiply, readWeightVector, scaledAdd, scaledAdd, scaledMultiply, scaledMultiply, setWeight, setWeight, size, toString, toString, toStringJustWeights, toStringJustWeightsprotected static final double defaultInitialBias
initialBias.protected double initialBias
bias.protected double bias
public BiasedWeightVector()
public BiasedWeightVector(double b)
b - The inital bias.public double dot(int[] exampleFeatures,
double[] exampleValues,
double defaultW)
BiasedWeightVector with the argument vector, using
the specified default weight when one is not yet present in this vector.dot in class SparseWeightVectorexampleFeatures - The example's array of feature indicesexampleValues - The example's array of feature valuesdefaultW - The default weight.public void scaledAdd(int[] exampleFeatures,
double[] exampleValues,
double factor,
double defaultW)
scaledAdd in class SparseWeightVectorexampleFeatures - The example's array of feature indicesexampleValues - The example's array of feature valuesfactor - The scaling factor.defaultW - An initial weight for previously unseen features.public void clear()
clear in class SparseWeightVectorpublic void write(PrintStream out)
BiasedWeightVector into the specified
PrintStream. The string representation is the same as in the super class, with
two added lines just after the "Begin" annotation that give the values of
bias and initialBias.write in class SparseWeightVectorout - The stream to write to.public void write(PrintStream out, Lexicon lex)
BiasedWeightVector into the specified
PrintStream. The string representation is the same as in the super class, with
two added lines just after the "Begin" annotation that give the values of
bias and initialBias.write in class SparseWeightVectorout - The stream to write to.lex - The feature lexicon.public void write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
write in class SparseWeightVectorout - The output stream.public void read(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessInputStream in)
This method is appropriate for reading weight vectors as written by
write(ExceptionlessOutputStream).
read in class SparseWeightVectorin - The input stream.public SparseWeightVector emptyClone()
emptyClone in class SparseWeightVectorCopyright © 2016. All rights reserved.