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

边栏推荐
- plain framework的实际应用和扩展
- The digital summit is popular, and city chain technology has triggered a new round of business transformation
- 2022 examination questions and online simulation examination for safety management personnel of hazardous chemical business units
- STM32F030F4驱动TIM1637数码管芯片
- Some thoughts on game performance optimization
- 微服务服务稳定性治理
- 通过Go语言创建CA与签发证书
- 日本购物网站的网络乞丐功能
- [MySQL] database optimization method
- Some abilities can't be learned from work. Look at this article, more than 90% of peers
猜你喜欢

window10安装wsl(一)(WslRegisterDistribution ERROR)

【Kotlin 第三方 】coil koltin协程图片加载库Coil类似Glide的图片加载第三方
![[JUC learning road day 9] barrier derivatives](/img/7d/25a49afa470cfef5b7b383918d6a7d.png)
[JUC learning road day 9] barrier derivatives
![[MySQL] index classification](/img/73/fb9f28457b373ad35d2f6068387b47.png)
[MySQL] index classification
![[micro service sentinel] sentinel integrates openfeign](/img/8b/46156255fd980eb422c7e05d5af7ee.png)
[micro service sentinel] sentinel integrates openfeign

Cisco test -- the concept and configuration test of routing

win 10 mstsc连接 RemoteApp

使用3DMax制作一个象棋棋子

玻璃马赛克

OpenVINO 模型性能评估工具—DL Workbench
随机推荐
Use of locust
微服务服务稳定性治理
window10安装wsl(一)(WslRegisterDistribution ERROR)
毕业季,既是告别,也是新的开始
Istio, ebpf and rsocket Broker: in depth study of service grid
Summary of "performance testing" of software testing, novice will know the knowledge points on the road
Detailed explanation of twenty common software testing methods (the most complete in History)
CKS CKA ckad change terminal to remote desktop
You probably haven't noticed the very important testing strategy in your work
openresty 负载均衡
[MySQL] basic use of explain and the function of each column
数字化转型道阻且长,如何迈好关键的第一步
Compare the version number [double pointer to intercept the string you want]
plain framework的实际应用和扩展
[JUC learning road day 9] barrier derivatives
会声会影2022智能、快速、简单的视频剪辑软件
MySQL -- deduction of index storage model
The difference between timer and scheduledthreadpoolexecutor
Win 10 mstsc connect RemoteApp
Advanced skills of testers: a guide to the application of unit test reports