Class ShrinkingMatrix
java.lang.Object
org.tribuo.math.la.DenseMatrix
org.tribuo.math.optimisers.util.ShrinkingMatrix
- All Implemented Interfaces:
- Serializable,- Iterable<MatrixTuple>,- Matrix,- Tensor,- ShrinkingTensor
A subclass of 
DenseMatrix which shrinks the value every time a new value is added.
 
 Be careful when modifying this or DenseMatrix.
- See Also:
- 
Field SummaryFields inherited from class org.tribuo.math.la.DenseMatrixdim1, dim2, valuesFields inherited from interface org.tribuo.math.optimisers.util.ShrinkingTensortolerance
- 
Constructor SummaryConstructorsConstructorDescriptionShrinkingMatrix(DenseMatrix v, double baseRate, boolean scaleShrinking) ShrinkingMatrix(DenseMatrix v, double baseRate, double lambda) 
- 
Method SummaryModifier and TypeMethodDescriptiondoubleget(int i, int j) Gets an element from thisMatrix.voidintersectAndAddInPlace(Tensor other, DoubleUnaryOperator f) Updates thisTensorby adding all the values from the intersection withother.iterator()leftMultiply(SGDVector input) Multiplies this Matrix by aSGDVectorreturning a vector of the appropriate size.voidscaleInPlace(double value) Scales each element of thisTensorbycoefficient.doubletwoNorm()Calculates the euclidean norm for this vector.Methods inherited from class org.tribuo.math.la.DenseMatrixadd, 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, transposeMethods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.IterableforEach, spliteratorMethods inherited from interface org.tribuo.math.la.TensorhadamardProductInPlace, intersectAndAddInPlace, scalarAddInPlace
- 
Constructor Details- 
ShrinkingMatrix
- 
ShrinkingMatrix
 
- 
- 
Method Details- 
convertToDense- Specified by:
- convertToDensein interface- ShrinkingTensor
 
- 
leftMultiplyDescription copied from interface:MatrixMultiplies this Matrix by aSGDVectorreturning a vector of the appropriate size.The input must have dimension equal to Matrix.getDimension2Size().- Specified by:
- leftMultiplyin interface- Matrix
- Overrides:
- leftMultiplyin class- DenseMatrix
- Parameters:
- input- The input vector.
- Returns:
- A new SGDVectorof sizeMatrix.getDimension1Size().
 
- 
intersectAndAddInPlaceDescription copied from interface:TensorUpdates thisTensorby adding all the values from the intersection withother.The function fis applied to all values fromotherbefore the addition.Each value is updated as value += f(otherValue). - Specified by:
- intersectAndAddInPlacein interface- Tensor
- Overrides:
- intersectAndAddInPlacein class- DenseMatrix
- Parameters:
- other- The other- Tensor.
- f- A function to apply.
 
- 
getpublic double get(int i, int j) Description copied from interface:MatrixGets an element from thisMatrix.- Specified by:
- getin interface- Matrix
- Overrides:
- getin class- DenseMatrix
- Parameters:
- i- The index for the first dimension.
- j- The index for the second dimension.
- Returns:
- The value at matrix[i][j].
 
- 
scaleInPlacepublic void scaleInPlace(double value) Description copied from interface:TensorScales each element of thisTensorbycoefficient.- Specified by:
- scaleInPlacein interface- Tensor
- Parameters:
- value- The coefficient of scaling.
 
- 
twoNormpublic double twoNorm()Description copied from interface:TensorCalculates the euclidean norm for this vector.- Specified by:
- twoNormin interface- Tensor
- Overrides:
- twoNormin class- DenseMatrix
- Returns:
- The euclidean norm.
 
- 
iterator- Specified by:
- iteratorin interface- Iterable<MatrixTuple>
- Overrides:
- iteratorin class- DenseMatrix
 
 
-