Class OnlineDictionaryLearner
- java.lang.Object
-
- edu.gsu.cs.dmlab.sparse.dictionary.OnlineDictionaryLearner
-
- All Implemented Interfaces:
ISparseDictionaryLearner
public class OnlineDictionaryLearner extends Object implements ISparseDictionaryLearner
Implements the online dictionary learning algorithm of Mairal et al., 2010. The algorithm can be found in "Sparse Modeling, Theory, Algorithms, and Applications" by Irina Rish and Genady Ya. Grabarnik. Published by CRC Press 2015, on page 172.- Author:
- Dustin Kempton, Data Mining Lab, Georgia State University
-
-
Constructor Summary
Constructors Constructor Description OnlineDictionaryLearner(ISparseVectorApproximator leqSolver, IDictionaryUpdater dictionaryUpdater, IDictionaryCleaner cleaner, double fractionOfInputSize, int batchSize, int numThreads)
Constructor that specifies the number of dictionary elements to contain in the returned dictionary as a fraction of the input matrix size.OnlineDictionaryLearner(ISparseVectorApproximator leqSolver, IDictionaryUpdater dictionaryUpdater, IDictionaryCleaner cleaner, int dictionaryElements, int batchSize, int numThreads)
Constructor that specifies the number of dictionary elements to contain in the returned dictionary.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
finalize()
void
rank1Update(smile.math.matrix.JMatrix mat, double[] vec1, double[] vec2)
smile.math.matrix.DenseMatrix
train(List<double[]> inputSamples)
Trains the sparse dictionary for the passed Data.
-
-
-
Constructor Detail
-
OnlineDictionaryLearner
public OnlineDictionaryLearner(ISparseVectorApproximator leqSolver, IDictionaryUpdater dictionaryUpdater, IDictionaryCleaner cleaner, double fractionOfInputSize, int batchSize, int numThreads)
Constructor that specifies the number of dictionary elements to contain in the returned dictionary as a fraction of the input matrix size.- Parameters:
leqSolver
- System of Linear Equations Solver used by this object.dictionaryUpdater
- Dictionary updated used by this object.cleaner
- Dictionary cleaner used by this object.fractionOfInputSize
- The fraction of the input size that is wished as an output number of dictionary elements. Must be 0.025 (2.5%) or greater.batchSize
- The number of elements to select from the input between dictionary updates.numThreads
- The number of threads to use when processing batch. -1 for all available > 0 for a specific number.
-
OnlineDictionaryLearner
public OnlineDictionaryLearner(ISparseVectorApproximator leqSolver, IDictionaryUpdater dictionaryUpdater, IDictionaryCleaner cleaner, int dictionaryElements, int batchSize, int numThreads)
Constructor that specifies the number of dictionary elements to contain in the returned dictionary.- Parameters:
leqSolver
- System of Linear Equations Solver used by this object.dictionaryUpdater
- Dictionary updated used by this object.cleaner
- Dictionary cleaner used by this object.dictionaryElements
- The number of dictionary elements to include in the returned dictionary.batchSize
- The number of elements to select from the input between dictionary updates.numThreads
- The number of threads to use when processing batch. -1 for all available > 0 for a specific number.
-
-
Method Detail
-
finalize
public void finalize() throws Throwable
-
train
public smile.math.matrix.DenseMatrix train(List<double[]> inputSamples) throws MatrixDimensionMismatch, VectorDimensionMismatch
Description copied from interface:ISparseDictionaryLearner
Trains the sparse dictionary for the passed Data.- Specified by:
train
in interfaceISparseDictionaryLearner
- Parameters:
inputSamples
- The data to train on. Each element in the list is a column vector in the input matrix.- Returns:
- The sparse dictionary.
- Throws:
MatrixDimensionMismatch
- When matrix dimensions are mismatched for this operation.VectorDimensionMismatch
- If this is thrown then there was something wrong internally.
-
rank1Update
public void rank1Update(smile.math.matrix.JMatrix mat, double[] vec1, double[] vec2)
-
-