public class BiasedRandomWeightVector extends RandomWeightVector
RandomWeightVector class that it extends, except that this vector also
contains a bias term (also initialized randomly) 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.
|
defaultStddev, instanceNumber, random, stddevdefaultCapacity, defaultWeight, weights| Constructor and Description |
|---|
BiasedRandomWeightVector()
Instantiates this biased vector with a random bias.
|
BiasedRandomWeightVector(double s)
Sets the specified standard deviation and a random bias.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Empties the weight map and resets the random number generator.
|
double |
dot(int[] exampleFeatures,
double[] exampleValues,
double defaultW)
Takes the dot product of this
BiasedRandomWeightVector 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 |
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 a textual representation of this vector to the specified stream.
|
void |
write(PrintStream out,
Lexicon lex)
Outputs a textual representation of this vector to the specified stream.
|
getWeight, readclone, dot, getWeight, pairwiseMultiply, readWeightVector, scaledAdd, scaledAdd, scaledMultiply, scaledMultiply, setWeight, setWeight, size, toString, toString, toStringJustWeights, toStringJustWeightspublic BiasedRandomWeightVector()
public BiasedRandomWeightVector(double s)
s - The standard deviation.public double dot(int[] exampleFeatures,
double[] exampleValues,
double defaultW)
BiasedRandomWeightVector 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()
dot(int[],double[],double) and scaledAdd(int[],double[],double,double) are
made in the same order.clear in class RandomWeightVectorpublic void write(PrintStream out)
SparseWeightVector.write(PrintStream), with two
added lines just after the "Begin" annotation that give the values of
RandomWeightVector.stddev and bias.write in class RandomWeightVectorout - The stream to write to.public void write(PrintStream out, Lexicon lex)
SparseWeightVector.write(PrintStream), with two
added lines just after the "Begin" annotation that give the values of
RandomWeightVector.stddev and bias.write in class RandomWeightVectorout - The stream to write to.lex - The feature lexicon.public void write(edu.illinois.cs.cogcomp.core.datastructures.vectors.ExceptionlessOutputStream out)
write in class RandomWeightVectorout - The output stream.public SparseWeightVector emptyClone()
emptyClone in class RandomWeightVectorCopyright © 2016. All rights reserved.