当前位置:网站首页>距离度量 —— 汉明距离(Hamming Distance)
距离度量 —— 汉明距离(Hamming Distance)
2022-07-01 22:52:00 【繁依Fanyi】
Python学习系列文章:目录
一、概述
汉明距离(Hamming Distance),就是将一个字符串变成另一个字符串所需要的替换次数。
二、计算方式
举个例子,
1011101
与1001001
的 汉明距离 为 2
式1 | 1 | 0 | 1 | 1 | 1 | 0 | 1 |
---|---|---|---|---|---|---|---|
式2 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
只要将 式1 中标红的部分换一下即可。
2143896
与2233786
的 汉明距离 为 3
式1 | 2 | 1 | 4 | 3 | 8 | 9 | 6 |
---|---|---|---|---|---|---|---|
式2 | 2 | 2 | 3 | 3 | 7 | 9 | 6 |
只要将 式1 中标红的部分换一下即可。
helloworld
与hollowoold
式1 | h | e | l | l | o | w | o | r | l | d |
---|---|---|---|---|---|---|---|---|---|---|
式2 | h | o | l | l | o | w | o | o | l | d |
只要将 式1 中标红的字母换一下即可。
三、汉明重量
汉明重量 就是字符串相对于相同长度的零字符串的汉明距离;也就是说,它是字符串中非零的元素个数:对于二进制字符串来说,就是 1 的个数,所以 11101
的汉明重量是 4。
因此,如果向量空间中的元素 a 和 b 之间的汉明距离等于它们汉明重量的差 a-b
。
边栏推荐
猜你喜欢
随机推荐
Cisco -- highly available and reliable network examination
MySQL -- deduction of index storage model
plain framework的实际应用和扩展
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
Use of locust
Explain JMM in detail
Wechat personal small store one click opening assistant applet development
Simple interactive operation of electron learning (III)
js——arguments的使用
[micro service sentinel] sentinel integrates openfeign
mysql binlog的清理
Redis~02 cache: how to ensure data consistency in MySQL and redis when updating data?
Huisheng Huiying 2022 intelligent, fast and simple video editing software
mysql ---- Oracle中的rownum转换成MySQL
CKS CKA CKAD 将终端更改为远程桌面
数字化转型道阻且长,如何迈好关键的第一步
AirServer最新Win64位个人版投屏软件
Jielizhi Bluetooth headset quality control and production skills [chapter]
openresty 负载均衡
Glass mosaic