An official website of the United States government
Here's how you know
Official websites use .gov
A
.gov website belongs to an official
government organization in the United States.
Secure .gov websites use HTTPS
A lock (
) or https:// means you've safely
connected to the .gov website. Share sensitive
information only on official, secure websites.
Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Input: Example , initialize dictionary D, sparse matrix X,
Output: Dictionary, sparse matrix.
1:
Initialize: Randomly take K column vectors from the original sample or take the first K column vectors of its left singular matrix as the atoms of the initial dictionary, and the dictionary , , maximum iterations J, tolerance value .
2:
Sparse coding: Using the dictionary , is obtained by
(2)
3:
Dictionary update: Update dictionary column by column, column .
When updating , calculate the error matrix , ;
Take out the set of indices where the k-th row vector of the sparse matrix is not 0, , .
Elect the column corresponding to from , and obtain .
Perform singular value decomposition of , , take the first column of U to update the k-th column of the dictionary, that is, ; Let , after obtaining , update accordingly it to the original .
Set .
4:
repeat
5:
The sparse coding and dictionary update steps;
6:
until the specified number of iteration steps J is reached, or converge to the specified error .