当前位置:网站首页>距离度量 —— 汉明距离(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。

边栏推荐
- The difference between timer and scheduledthreadpoolexecutor
- rviz打开后如何显示实时2D地图
- Introduction and use of plantuml
- Jerry's records are powered by Vbat with a power supply voltage of 4.2V [chapter]
- 【Swoole系列1】在Swoole的世界中,你将学习到什么?
- Copy ‘XXXX‘ to effectively final temp variable
- Openresty load balancing
- 微信个人小商店一键开通助手小程序开发
- What is the relationship between modeling and later film and television?
- 使用3DMax制作一个象棋棋子
猜你喜欢

MySQL -- deduction of index storage model

【小程序】通过scroll-view组件实现左右【滑动】列表

MySQL binlog cleanup

SWT/ANR问题--SWT 导致 kernel fuse deadlock

Explain JMM in detail

What is the relationship between modeling and later film and television?
![[JUC learning road day 9] barrier derivatives](/img/7d/25a49afa470cfef5b7b383918d6a7d.png)
[JUC learning road day 9] barrier derivatives

实在RPA:银行数字化,业务流程自动化“一小步”,贷款审核效率“一大步”
![[MySQL] index classification](/img/73/fb9f28457b373ad35d2f6068387b47.png)
[MySQL] index classification

win 10 mstsc连接 RemoteApp
随机推荐
Compare the version number [double pointer to intercept the string you want]
微服务服务稳定性治理
“35岁,公司老总,月薪2万送外卖“:时代抛弃你,连声再见都没有
Wechat personal small store one click opening assistant applet development
Data enhancement of semi supervised learning
Matplotlib常用图表
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received
Redis数据类型和应用场景
从第三次技术革命看企业应用三大开发趋势
Force buckle 710 Random numbers in the blacklist
软考信息系统项目管理师_整理的十大管理过程的简写帮助记忆背诵---软考高级之信息系统项目管理师054
认识线程
[JUC learning road day 9] barrier derivatives
plain framework的实际应用和扩展
"35 years old, the boss of the company, with a monthly salary of 20000, give away takeout": the times abandoned you, not even saying goodbye
2022 examination questions and online simulation examination for safety management personnel of hazardous chemical business units
What is the mosaic tailgate?
日本购物网站的网络乞丐功能
证券开户选哪个证券公司比较好,哪个更安全
rviz打开后如何显示实时2D地图