Sparse Matrix (Compressed Sparse Row, CSR)

Feature matrices from Concept - Bag of Words are mostly zeros, since most documents contain only a small subset of the vocabulary (02 Pre-processing s.70). Instead of storing all zeros, represent each row as a list of pairs (column number, nonzero value).

Dense rowSparse pairs
0 15 0 3(2,15) (4,3)
12 0 0 0(1,12)
8 0 5 2(1,8) (3,5) (4,2)

(Columns numbered from 1, as on the slide.)

Concept - Document-Term Matrix | Concept - Curse of Dimensionality | Concept - Dictionary Reduction

Appears in