public class BilinearSparseOnlineLearner extends Object implements OnlineLearner<gov.sandia.cognition.math.matrix.Matrix,gov.sandia.cognition.math.matrix.Matrix>, ReadWriteableBinary
| Modifier and Type | Field and Description |
|---|---|
protected gov.sandia.cognition.math.matrix.Matrix |
bias |
protected Boolean |
biasMode |
protected gov.sandia.cognition.math.matrix.Matrix |
diagX |
protected Double |
eta0_u |
protected Double |
eta0_w |
protected Double |
lambda_u |
protected Double |
lambda_w |
protected LossFunction |
loss |
protected BilinearLearnerParameters |
params |
protected Regulariser |
regul |
protected gov.sandia.cognition.math.matrix.mtj.SparseMatrixFactoryMTJ |
smf |
protected gov.sandia.cognition.math.matrix.Matrix |
u |
protected gov.sandia.cognition.math.matrix.Matrix |
w |
| Constructor and Description |
|---|
BilinearSparseOnlineLearner()
The default parameters.
|
BilinearSparseOnlineLearner(BilinearLearnerParameters params) |
| Modifier and Type | Method and Description |
|---|---|
void |
addU(int newUsers)
Expand the U parameters matrix by added a set of rows.
|
void |
addW(int newWords)
Expand the W parameters matrix by added a set of rows.
|
byte[] |
binaryHeader()
Header for binary input.
|
BilinearSparseOnlineLearner |
clone() |
protected double |
etat(int iter,
double eta0) |
static gov.sandia.cognition.math.matrix.mtj.SparseMatrix |
expandY(gov.sandia.cognition.math.matrix.Matrix Y)
Given a flat value matrix, makes a diagonal sparse matrix containing the values as the diagonal
|
gov.sandia.cognition.math.matrix.Matrix |
getBias() |
BilinearLearnerParameters |
getParams() |
gov.sandia.cognition.math.matrix.Matrix |
getU() |
gov.sandia.cognition.math.matrix.Matrix |
getW() |
gov.sandia.cognition.math.matrix.Matrix |
predict(gov.sandia.cognition.math.matrix.Matrix x) |
void |
process(gov.sandia.cognition.math.matrix.Matrix X,
gov.sandia.cognition.math.matrix.Matrix Y) |
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
reinitParams()
must be called if any parameters are changed
|
void |
setU(gov.sandia.cognition.math.matrix.Matrix newu) |
void |
setW(gov.sandia.cognition.math.matrix.Matrix neww) |
protected gov.sandia.cognition.math.matrix.Matrix |
updateBias(gov.sandia.cognition.math.matrix.Matrix xt,
gov.sandia.cognition.math.matrix.Matrix nu,
gov.sandia.cognition.math.matrix.Matrix nw,
double biasLossWeight) |
protected gov.sandia.cognition.math.matrix.Matrix |
updateU(gov.sandia.cognition.math.matrix.Matrix xtrows,
gov.sandia.cognition.math.matrix.Matrix neww,
double uLossWeight,
double uWeightedLambda) |
protected gov.sandia.cognition.math.matrix.Matrix |
updateW(gov.sandia.cognition.math.matrix.Matrix xt,
double wLossWeighted,
double weightedLambda) |
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
protected BilinearLearnerParameters params
protected gov.sandia.cognition.math.matrix.Matrix w
protected gov.sandia.cognition.math.matrix.Matrix u
protected gov.sandia.cognition.math.matrix.mtj.SparseMatrixFactoryMTJ smf
protected LossFunction loss
protected Regulariser regul
protected gov.sandia.cognition.math.matrix.Matrix bias
protected gov.sandia.cognition.math.matrix.Matrix diagX
public BilinearSparseOnlineLearner()
public BilinearSparseOnlineLearner(BilinearLearnerParameters params)
params - the parameters used by this learnerpublic void reinitParams()
public void process(gov.sandia.cognition.math.matrix.Matrix X, gov.sandia.cognition.math.matrix.Matrix Y)
process in interface OnlineLearner<gov.sandia.cognition.math.matrix.Matrix,gov.sandia.cognition.math.matrix.Matrix>protected gov.sandia.cognition.math.matrix.Matrix updateBias(gov.sandia.cognition.math.matrix.Matrix xt, gov.sandia.cognition.math.matrix.Matrix nu, gov.sandia.cognition.math.matrix.Matrix nw, double biasLossWeight)
protected gov.sandia.cognition.math.matrix.Matrix updateW(gov.sandia.cognition.math.matrix.Matrix xt, double wLossWeighted, double weightedLambda)
protected gov.sandia.cognition.math.matrix.Matrix updateU(gov.sandia.cognition.math.matrix.Matrix xtrows, gov.sandia.cognition.math.matrix.Matrix neww, double uLossWeight, double uWeightedLambda)
public static gov.sandia.cognition.math.matrix.mtj.SparseMatrix expandY(gov.sandia.cognition.math.matrix.Matrix Y)
Y - protected double etat(int iter, double eta0)
public BilinearLearnerParameters getParams()
public gov.sandia.cognition.math.matrix.Matrix getU()
public gov.sandia.cognition.math.matrix.Matrix getW()
public gov.sandia.cognition.math.matrix.Matrix getBias()
BilinearLearnerParameters.BIAS is falsepublic void addU(int newUsers)
BilinearLearnerParameters.EXPANDEDUINITSTRATnewUsers - the number of new users to addpublic void addW(int newWords)
BilinearLearnerParameters.EXPANDEDWINITSTRATnewWords - the number of new words to addpublic BilinearSparseOnlineLearner clone()
public void setU(gov.sandia.cognition.math.matrix.Matrix newu)
newu - set the model's Upublic void setW(gov.sandia.cognition.math.matrix.Matrix neww)
neww - set the model's Wpublic void readBinary(DataInput in) throws IOException
ReadableBinaryreadBinary in interface ReadableBinaryin - source to read from.IOException - an error reading inputpublic byte[] binaryHeader()
ReadableBinarybinaryHeader in interface ReadableBinarybinaryHeader in interface WriteableBinarypublic void writeBinary(DataOutput out) throws IOException
WriteableBinarywriteBinary in interface WriteableBinaryout - sink to write toIOException - an error writing to outpublic gov.sandia.cognition.math.matrix.Matrix predict(gov.sandia.cognition.math.matrix.Matrix x)
predict in interface OnlineLearner<gov.sandia.cognition.math.matrix.Matrix,gov.sandia.cognition.math.matrix.Matrix>