DefinitionEdit

Given two squences (or strings) of symbols in an alphabet $\mathcal{L}$, the Hamming similarity is a function $HammingSim:\mathcal{L}^*\times\mathcal{L}^*\longrightarrow [0,1]$ that measures the number of positions for which the corresponding symbols are equals, divided by the length of the bigest sequence:

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

where $IdSim$ is the Identity similarity.

Examples Edit

• HammingSim('house','horse') = 4/5 = 0.8.
• HammingSim('abcd',' ') = 0/4 = 0.
• HammingSim('abcd','a') = 1/4 = 0.25.
• HammingSim('abcd','b') = 0/4 = 0.
• HammingSim('id0345','id1352') = 3/6 = 0.5.

Normalization Edit

It is normalized.

Applications Edit

• Comparing codes.