Normalized Compression Distance
The normalized compression distance compares two strings by how many extra bytes a compressor needs for their concatenation beyond the larger of the two alone. It approximates the information distance from Kolmogorov complexity and needs no features, language model or tokenisation, so it works for texts, code, DNA or any symbol sequences.
정규화 압축 거리는 두 문자열을 이어 붙였을 때 압축기가 둘 중 큰 쪽만 압축할 때보다 몇 바이트를 더 쓰는지로 두 문자열을 비교합니다. 콜모고로프 복잡도에 기반한 정보 거리의 근사이며, 특징 선택이나 언어 모형, 토큰화가 필요 없어 텍스트, 코드, DNA 등 어떤 기호열에도 쓸 수 있습니다.
Which documents or sequences are most alike, without choosing features or a language model?
특징이나 언어 모형을 고르지 않고도 어떤 문서나 서열끼리 가장 비슷한지 알 수 있을까요?
Each document and each concatenated pair is compressed with zlib, bz2 or lzma, and the distance is computed for every pair (averaging both concatenation orders). The method lists each document's nearest neighbour, the range of distances, and, when groups are given, compares within- and between-group distances by a permutation test.
When to use Normalized Compression Distance
- You need a similarity measure for texts, logs, code or sequences in any language or format.
- You want to check whether documents from the same source are closer to each other than to others.
- You want a quick, assumption-light way to find near-duplicates.
When to use something else
- You need word-based similarity with weighting: use TF-IDF Document Similarity and Clustering
- You compare numeric vectors: use Cosine Similarity Analysis
- The strings are very short (a few words): compression overhead dominates
Assumptions and requirements
- Documents long enough for the compressor (a few hundred bytes or more)
- For zlib, documents shorter than about 16 KB
- The compressor approximates the ideal compressor
What the analysis reports
- Pairwise distance summary and closest pair
- Nearest neighbour for each document
- Within- versus between-group comparison and permutation p-value
- Histogram of distances
How to report it
Normalized compression distances among [value] documents (zlib) ranged from [value] to [value] (mean [value]); distances between groups exceeded those within groups by [value] (permutation p = [value]).
Related methods
- TF-IDF Document Similarity and Clustering
- Cosine Similarity Analysis
- Compression-Based Complexity Estimation
How this method is validated
이 방법의 검증 근거
- Independent computation. 1 reference test compares the results with direct computations (formulas, enumeration or simulation).
독립 계산. 직접 계산(식·열거·모의실험) 대조 참조 시험 1건 통과.
Tolerances are relative differences (absolute differences for values near zero). R comparisons and reference tests are re-run before each release of the analysis engine.
허용오차는 상대 차이입니다(0 근처 값은 절대 차이). R 대조와 참조 시험은 분석 엔진을 배포할 때마다 다시 돌립니다.
Run Normalized Compression Distance on Quorant
- Data you need
- a table (CSV or Excel) with a text column
- Price
- 250 credits for one analysis up to 10,000 rows (complexity level 2); larger or wider data costs more. Optional methodologist review: 1200 credits.
- Checking
- Compared with independent computations
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.