## DefinitionEdit

Given a universe set $E$, the Hamming similarity for vectors is a function $HammingSim:E^n\times E^n\longrightarrow [0,1]$ that measures the number of equals components, divided by the length of vectors.

$HammingSim(s,t)=\frac{\sum_{i=1}^{n}IdSim(s[i],t[i])}{n},$

where $IdSim$ is the Identity similarity.

## Examples Edit

• HammingSim((0,1,0,1,1),(1,0,0,1,0)) = 2/5 = 0.4.
• HammingSim((a,b,a,c,b),(b,c,a,b,a)) = 1/5 = 0.2.
• HammingSim((a,b,c,d),(d,c,b,a)) = 0/4 = 0;

## Normalization Edit

It is normalized.

## Variations Edit

When the components of vectors are of different types, we have the Hamming similarity for tuples, and if vectors are of different lenght we have the Hamming similarity for sequences.

## Applications Edit

Useful for comparing codes.