当前位置:网站首页>距离度量 —— 汉明距离(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
。
边栏推荐
- What is mosaic?
- Explain JMM in detail
- Jielizhi, production line assembly link [chapter]
- Cisco -- an external tool for WAN's concept examination
- Advanced skills of testers: a guide to the application of unit test reports
- 若干互联网暴露面的收敛及处置建议
- 日本购物网站的网络乞丐功能
- 建模和影视后期有什么关联?
- Typescript enumeration
- 数字峰会人气火爆,城链科技引发新一轮商业变革
猜你喜欢
Cisco test -- the concept and configuration test of routing
window10安装wsl(一)(WslRegisterDistribution ERROR)
plain framework的实际应用和扩展
2022年起重机司机(限桥式起重机)考试试题及模拟考试
MySQL binlog cleanup
flutter Unable to load asset: assets/images/888. png
Redis~02 缓存:更新数据时如何保证MySQL和Redis中的数据一致性?
Groups and ranges of regular series
CKS CKA CKAD 将终端更改为远程桌面
Advanced skills of testers: a guide to the application of unit test reports
随机推荐
软考信息系统项目管理师_整理的十大管理过程的简写帮助记忆背诵---软考高级之信息系统项目管理师054
Explain ThreadLocal in detail
[MySQL] index creation, viewing and deletion
Use of locust
CKS CKA ckad change terminal to remote desktop
攻防演习防御体系构建之第三篇之建立实战化的安全体系
MySQL -- convert rownum in Oracle to MySQL
【微服务|Sentinel】sentinel整合openfeign
想请教股票开户要认识谁?在线开户是安全么?
Convergence and disposal suggestions of some Internet exposure surfaces
rviz打开后如何显示实时2D地图
[MySQL] index classification
AirServer最新Win64位个人版投屏软件
Which securities company is better and which is safer to open a securities account
Redis~02 缓存:更新数据时如何保证MySQL和Redis中的数据一致性?
OpenVINO 模型性能评估工具—DL Workbench
内存泄露和内存溢出的区别是什么?
win 10 mstsc连接 RemoteApp
Some thoughts on game performance optimization
2022 crane driver (limited to bridge crane) examination questions and simulation examination