[Paper Review] Online Grammar Compression for Frequent Pattern Discovery
This paper proposes an online grammar compression algorithm for frequent pattern discovery that achieves a significantly improved approximation ratio of $\Omega(\frac{1}{\lg^{*}N\lg m})$ over previous work, while operating in compressed space. By integrating a fully online ESP-based parsing method (FOLCA), the algorithm enables efficient, streaming processing of repetitive strings with minimal memory usage, outperforming offline methods in space efficiency while maintaining near-optimal pattern extraction.
Various grammar compression algorithms have been proposed in the last decade. A grammar compression is a restricted CFG deriving the string deterministically. An efficient grammar compression develops a smaller CFG by finding duplicated patterns and removing them. This process is just a frequent pattern discovery by grammatical inference. While we can get any frequent pattern in linear time using a preprocessed string, a huge working space is required for longer patterns, and the whole string must be loaded into the memory preliminarily. We propose an online algorithm approximating this problem within a compressed space. The main contribution is an improvement of the previously best known approximation ratio $Ω(\frac{1}{\lg^2m})$ to $Ω(\frac{1}{\lg^*N\lg m})$ where $m$ is the length of an optimal pattern in a string of length $N$ and $\lg^*$ is the iteration of the logarithm base $2$. For a sufficiently large $N$, $\lg^*N$ is practically constant. The experimental results show that our algorithm extracts nearly optimal patterns and achieves a significant improvement in memory consumption compared to the offline algorithm.
Motivation & Objective
- To address the challenge of frequent pattern discovery in large-scale, repetitive strings where offline methods require excessive memory.
- To develop an online algorithm that approximates long frequent patterns using grammar compression with minimal space overhead.
- To improve the theoretical approximation ratio from $\Omega(\frac{1}{\lg^{2}m})$ to $\Omega(\frac{1}{\lg^{*}N\lg m})$, where $N$ is the string length and $m$ is the optimal pattern length.
- To enable practical deployment on streaming data by leveraging a fully online grammar compression framework (FOLCA).
- To empirically validate that the algorithm extracts nearly optimal patterns while drastically reducing memory consumption compared to offline approaches.
Proposed method
- The algorithm uses Edit-Sensitive Parsing (ESP) to identify repeated substrings and build a compact parsing tree (POSLP) that preserves frequent patterns.
- It applies a fully online grammar compression method (FOLCA) to construct the POSLP in compressed space, avoiding full string loading.
- The method identifies variables in the grammar that derive substrings of length $\Omega(\frac{|P|}{\lg^{*}N\lg|P|})$ for any frequent pattern $P$, ensuring strong approximation guarantees.
- It leverages succinct data structures to track variable frequencies in the parsing tree using only $n$ bits per internal node, minimizing space.
- The algorithm processes the string in a streaming fashion, constructing the grammar incrementally without storing the entire input.
- Theoretical analysis establishes a new lower bound on approximation quality, improving upon prior work by replacing $\lg^2 m$ with $\lg^* N \lg m$ in the denominator.
Experimental results
Research questions
- RQ1Can an online grammar compression algorithm achieve a better approximation ratio for frequent pattern discovery than existing offline methods?
- RQ2Can the approximation ratio be improved from $\Omega(\frac{1}{\lg^2 m})$ to $\Omega(\frac{1}{\lg^* N \lg m})$ while maintaining space efficiency?
- RQ3Is it possible to perform grammar compression and frequent pattern discovery in a streaming fashion with compressed space usage?
- RQ4How does the practical performance of the online algorithm compare to offline methods in terms of pattern quality and memory consumption?
- RQ5To what extent does the algorithm preserve long frequent patterns in highly repetitive data?
Key findings
- The proposed algorithm achieves an approximation ratio of $\Omega(\frac{1}{\lg^{*}N\lg m})$, significantly improving upon the prior $\Omega(\frac{1}{\lg^2 m})$ bound.
- For the einstein benchmark, the algorithm extracted cores with a mean cover ratio of 21.6% of the optimal pattern length, indicating strong practical performance.
- In the dna dataset, the algorithm achieved a mean approximation ratio of 22.9%, demonstrating consistent extraction of long frequent patterns.
- Memory consumption was drastically reduced—especially for large inputs—where the offline suffix array method failed due to memory limits.
- Computation time was acceptable, with the online algorithm being a few times slower than offline methods, but with a favorable time-space tradeoff.
- The algorithm successfully extracted nearly optimal patterns across all benchmarks, confirming its practical effectiveness despite a theoretical gap in approximation ratio.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.