public class ShrinkingMatrix extends DenseMatrix implements ShrinkingTensor
DenseMatrix
which shrinks the value every time a new value is added.
Be careful when modifying this or DenseMatrix
.
dim1, dim2, values
tolerance
Constructor and Description |
---|
ShrinkingMatrix(DenseMatrix v,
double baseRate,
boolean scaleShrinking) |
ShrinkingMatrix(DenseMatrix v,
double baseRate,
double lambda) |
Modifier and Type | Method and Description |
---|---|
DenseMatrix |
convertToDense() |
double |
get(int i,
int j)
Gets an element from this
Matrix . |
void |
intersectAndAddInPlace(Tensor other,
DoubleUnaryOperator f)
Updates this
Tensor by adding all the values from the intersection with other . |
MatrixIterator |
iterator() |
DenseVector |
leftMultiply(SGDVector input)
Multiplies this Matrix by a
SGDVector returning a vector of the appropriate size. |
void |
scaleInPlace(double value)
Scales each element of this
Tensor by coefficient . |
double |
twoNorm()
Calculates the euclidean norm for this vector.
|
add, addAcrossDim1, addAcrossDim2, broadcastIntersectAndAddInPlace, columnSum, columnSum, copy, createDenseMatrix, equals, foreachInPlace, gatherAcrossDim1, gatherAcrossDim2, getColumn, getDimension1Size, getDimension2Size, getRow, getShape, hadamardProductInPlace, hashCode, matrixMultiply, matrixMultiply, normalizeRows, numActiveElements, reshape, rightMultiply, rowScaleInPlace, rowSum, rowSum, set, toString, transpose
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
hadamardProductInPlace, intersectAndAddInPlace, scalarAddInPlace, shapeCheck, shapeSum
forEach, spliterator
public ShrinkingMatrix(DenseMatrix v, double baseRate, boolean scaleShrinking)
public ShrinkingMatrix(DenseMatrix v, double baseRate, double lambda)
public DenseMatrix convertToDense()
convertToDense
in interface ShrinkingTensor
public DenseVector leftMultiply(SGDVector input)
Matrix
SGDVector
returning a vector of the appropriate size.
The input must have dimension equal to Matrix.getDimension2Size()
.
leftMultiply
in interface Matrix
leftMultiply
in class DenseMatrix
input
- The input vector.SGDVector
of size Matrix.getDimension1Size()
.public void intersectAndAddInPlace(Tensor other, DoubleUnaryOperator f)
Tensor
Tensor
by adding all the values from the intersection with other
.
The function f
is applied to all values from other
before the
addition.
Each value is updated as value += f(otherValue).
intersectAndAddInPlace
in interface Tensor
intersectAndAddInPlace
in class DenseMatrix
other
- The other Tensor
.f
- A function to apply.public double get(int i, int j)
Matrix
Matrix
.get
in interface Matrix
get
in class DenseMatrix
i
- The index for the first dimension.j
- The index for the second dimension.public void scaleInPlace(double value)
Tensor
Tensor
by coefficient
.scaleInPlace
in interface Tensor
value
- The coefficient of scaling.public double twoNorm()
Tensor
twoNorm
in interface Tensor
twoNorm
in class DenseMatrix
public MatrixIterator iterator()
iterator
in interface Iterable<MatrixTuple>
iterator
in class DenseMatrix
Copyright © 2015–2021 Oracle and/or its affiliates. All rights reserved.