public class MatlibBilinearSparseOnlineLearner extends Object implements OnlineLearner<Matrix,Matrix>, ReadWriteableBinary
Modifier and Type | Field and Description |
---|---|
protected Matrix |
bias |
protected Boolean |
biasMode |
protected 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 Matrix |
u |
protected 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()
Header for binary input.
|
MatlibBilinearSparseOnlineLearner |
clone() |
static SparseMatrix |
expandY(Matrix Y)
Given a flat value matrix, makes a diagonal sparse matrix containing the values as the diagonal
|
Matrix |
getBias() |
BilinearLearnerParameters |
getParams() |
Matrix |
getU() |
Matrix |
getW() |
Matrix |
predict(Matrix x) |
void |
process(Matrix X,
Matrix Y) |
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
reinitParams()
must be called if any parameters are changed
|
void |
setU(Matrix newu) |
void |
setW(Matrix neww) |
protected Matrix |
updateBias(Matrix biasGrad,
double biasLossWeight) |
protected Matrix |
updateU(Matrix currentU,
double uLossWeight,
double uWeightedLambda) |
protected Matrix |
updateW(Matrix currentW,
double wLossWeighted,
double weightedLambda) |
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
protected BilinearLearnerParameters params
protected LossFunction loss
protected Regulariser regul
public MatlibBilinearSparseOnlineLearner()
public MatlibBilinearSparseOnlineLearner(BilinearLearnerParameters params)
params
- the parameters used by this learnerpublic void reinitParams()
public void process(Matrix X, Matrix Y)
process
in interface OnlineLearner<Matrix,Matrix>
protected Matrix updateBias(Matrix biasGrad, double biasLossWeight)
public static SparseMatrix expandY(Matrix Y)
Y
- public BilinearLearnerParameters getParams()
public Matrix getBias()
BilinearLearnerParameters.BIAS
is falsepublic void addU(int newUsers)
BilinearLearnerParameters.EXPANDEDUINITSTRAT
newUsers
- the number of new users to addpublic void addW(int newWords)
BilinearLearnerParameters.EXPANDEDWINITSTRAT
newWords
- the number of new words to addpublic MatlibBilinearSparseOnlineLearner clone()
public void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to out