public class MatlibBilinearSparseOnlineLearner extends Object implements OnlineLearner<ch.akuhn.matrix.Matrix,ch.akuhn.matrix.Matrix>, org.openimaj.io.ReadWriteableBinary
| Modifier and Type | Field and Description |
|---|---|
protected ch.akuhn.matrix.Matrix |
bias |
protected Boolean |
biasMode |
protected ch.akuhn.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 ch.akuhn.matrix.Matrix |
u |
protected ch.akuhn.matrix.Matrix |
w |
| Constructor and Description |
|---|
MatlibBilinearSparseOnlineLearner()
The default parameters.
|
MatlibBilinearSparseOnlineLearner(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() |
MatlibBilinearSparseOnlineLearner |
clone() |
static ch.akuhn.matrix.SparseMatrix |
expandY(ch.akuhn.matrix.Matrix Y)
Given a flat value matrix, makes a diagonal sparse matrix containing the values as the diagonal
|
ch.akuhn.matrix.Matrix |
getBias() |
BilinearLearnerParameters |
getParams() |
ch.akuhn.matrix.Matrix |
getU() |
ch.akuhn.matrix.Matrix |
getW() |
ch.akuhn.matrix.Matrix |
predict(ch.akuhn.matrix.Matrix x) |
void |
process(ch.akuhn.matrix.Matrix X,
ch.akuhn.matrix.Matrix Y) |
void |
readBinary(DataInput in) |
void |
reinitParams()
must be called if any parameters are changed
|
void |
setU(ch.akuhn.matrix.Matrix newu) |
void |
setW(ch.akuhn.matrix.Matrix neww) |
protected ch.akuhn.matrix.Matrix |
updateBias(ch.akuhn.matrix.Matrix biasGrad,
double biasLossWeight) |
protected ch.akuhn.matrix.Matrix |
updateU(ch.akuhn.matrix.Matrix currentU,
double uLossWeight,
double uWeightedLambda) |
protected ch.akuhn.matrix.Matrix |
updateW(ch.akuhn.matrix.Matrix currentW,
double wLossWeighted,
double weightedLambda) |
void |
writeBinary(DataOutput out) |
protected BilinearLearnerParameters params
protected ch.akuhn.matrix.Matrix w
protected ch.akuhn.matrix.Matrix u
protected LossFunction loss
protected Regulariser regul
protected ch.akuhn.matrix.Matrix bias
protected ch.akuhn.matrix.Matrix diagX
public MatlibBilinearSparseOnlineLearner()
public MatlibBilinearSparseOnlineLearner(BilinearLearnerParameters params)
params - the parameters used by this learnerpublic void reinitParams()
public void process(ch.akuhn.matrix.Matrix X, ch.akuhn.matrix.Matrix Y)
process in interface OnlineLearner<ch.akuhn.matrix.Matrix,ch.akuhn.matrix.Matrix>protected ch.akuhn.matrix.Matrix updateBias(ch.akuhn.matrix.Matrix biasGrad, double biasLossWeight)
protected ch.akuhn.matrix.Matrix updateW(ch.akuhn.matrix.Matrix currentW, double wLossWeighted, double weightedLambda)
protected ch.akuhn.matrix.Matrix updateU(ch.akuhn.matrix.Matrix currentU, double uLossWeight, double uWeightedLambda)
public static ch.akuhn.matrix.SparseMatrix expandY(ch.akuhn.matrix.Matrix Y)
Y - public BilinearLearnerParameters getParams()
public ch.akuhn.matrix.Matrix getU()
public ch.akuhn.matrix.Matrix getW()
public ch.akuhn.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 MatlibBilinearSparseOnlineLearner clone()
public void setU(ch.akuhn.matrix.Matrix newu)
newu - set the model's Upublic void setW(ch.akuhn.matrix.Matrix neww)
neww - set the model's Wpublic void readBinary(DataInput in) throws IOException
readBinary in interface org.openimaj.io.ReadableBinaryIOExceptionpublic byte[] binaryHeader()
binaryHeader in interface org.openimaj.io.ReadableBinarybinaryHeader in interface org.openimaj.io.WriteableBinarypublic void writeBinary(DataOutput out) throws IOException
writeBinary in interface org.openimaj.io.WriteableBinaryIOExceptionpublic ch.akuhn.matrix.Matrix predict(ch.akuhn.matrix.Matrix x)
predict in interface OnlineLearner<ch.akuhn.matrix.Matrix,ch.akuhn.matrix.Matrix>