Hamming Distance

Practical Deep Learning: Image Search Engine Dataset Preprocessing and Helper Functions
1 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€59.72
List Price:  €85.31
You save:  €25.59
£51.10
List Price:  £73.01
You save:  £21.90
CA$95.74
List Price:  CA$136.78
You save:  CA$41.03
A$107.26
List Price:  A$153.24
You save:  A$45.97
S$89.24
List Price:  S$127.49
You save:  S$38.25
HK$549.41
List Price:  HK$784.91
You save:  HK$235.49
CHF 55.81
List Price:  CHF 79.74
You save:  CHF 23.92
NOK kr706.78
List Price:  NOK kr1,009.73
You save:  NOK kr302.95
DKK kr445.56
List Price:  DKK kr636.55
You save:  DKK kr190.98
NZ$115.49
List Price:  NZ$165
You save:  NZ$49.50
د.إ257.03
List Price:  د.إ367.21
You save:  د.إ110.17
৳8,557.21
List Price:  ৳12,225.11
You save:  ৳3,667.90
₹6,002.34
List Price:  ₹8,575.15
You save:  ₹2,572.80
RM294.69
List Price:  RM421
You save:  RM126.31
₦107,939.27
List Price:  ₦154,205.57
You save:  ₦46,266.30
₨19,843.67
List Price:  ₨28,349.32
You save:  ₨8,505.64
฿2,275.40
List Price:  ฿3,250.72
You save:  ฿975.31
₺2,785.93
List Price:  ₺3,980.07
You save:  ₺1,194.14
B$384.24
List Price:  B$548.94
You save:  B$164.70
R1,244.30
List Price:  R1,777.65
You save:  R533.35
Лв116.73
List Price:  Лв166.77
You save:  Лв50.03
₩94,808.60
List Price:  ₩135,446.66
You save:  ₩40,638.06
₪235.88
List Price:  ₪336.99
You save:  ₪101.11
₱3,950.72
List Price:  ₱5,644.13
You save:  ₱1,693.41
¥10,097.25
List Price:  ¥14,425.26
You save:  ¥4,328.01
MX$1,320.32
List Price:  MX$1,886.26
You save:  MX$565.93
QR255.02
List Price:  QR364.33
You save:  QR109.31
P935.39
List Price:  P1,336.34
You save:  P400.94
KSh9,042.70
List Price:  KSh12,918.70
You save:  KSh3,876
E£3,471.28
List Price:  E£4,959.19
You save:  E£1,487.90
ብር9,451.70
List Price:  ብር13,503.01
You save:  ብር4,051.31
Kz63,827.73
List Price:  Kz91,186.38
You save:  Kz27,358.65
CLP$65,188.17
List Price:  CLP$93,129.96
You save:  CLP$27,941.78
CN¥501.42
List Price:  CN¥716.34
You save:  CN¥214.92
RD$4,162.43
List Price:  RD$5,946.58
You save:  RD$1,784.15
DA9,055.89
List Price:  DA12,937.54
You save:  DA3,881.65
FJ$156.83
List Price:  FJ$224.05
You save:  FJ$67.22
Q538.08
List Price:  Q768.73
You save:  Q230.64
GY$14,631.53
List Price:  GY$20,903.09
You save:  GY$6,271.55
ISK kr8,491.88
List Price:  ISK kr12,131.78
You save:  ISK kr3,639.90
DH631.71
List Price:  DH902.48
You save:  DH270.77
L1,184.88
List Price:  L1,692.76
You save:  L507.87
ден3,672.46
List Price:  ден5,246.60
You save:  ден1,574.13
MOP$565.76
List Price:  MOP$808.27
You save:  MOP$242.50
N$1,252.95
List Price:  N$1,790
You save:  N$537.05
C$2,574.86
List Price:  C$3,678.54
You save:  C$1,103.67
रु9,572.52
List Price:  रु13,675.61
You save:  रु4,103.09
S/248.33
List Price:  S/354.78
You save:  S/106.44
K288.60
List Price:  K412.31
You save:  K123.70
SAR262.49
List Price:  SAR375.01
You save:  SAR112.51
ZK1,656.43
List Price:  ZK2,366.43
You save:  ZK710
L303.23
List Price:  L433.20
You save:  L129.97
Kč1,477.69
List Price:  Kč2,111.08
You save:  Kč633.38
Ft23,864.94
List Price:  Ft34,094.24
You save:  Ft10,229.29
SEK kr664.98
List Price:  SEK kr950.02
You save:  SEK kr285.03
ARS$83,165.26
List Price:  ARS$118,812.61
You save:  ARS$35,647.34
Bs483.43
List Price:  Bs690.65
You save:  Bs207.21
COP$282,636.81
List Price:  COP$403,784.18
You save:  COP$121,147.37
₡35,287.23
List Price:  ₡50,412.50
You save:  ₡15,125.26
L1,828.15
List Price:  L2,611.75
You save:  L783.60
₲558,333.27
List Price:  ₲797,653.15
You save:  ₲239,319.87
$U2,813.53
List Price:  $U4,019.51
You save:  $U1,205.97
zł253.33
List Price:  zł361.92
You save:  zł108.58
Already have an account? Log In

Transcript

Hello everyone, before we start with the code for this video, there is a little change that we have to make in the cosine distance function from the previous video. The change is to add the square brackets and the zero between them after query vector, we are doing this because of the dimensionality of the neural network output. This will access the first element of the output. Now let's get back to hamming distance. If you haven't heard about this distance before, that's totally okay. It is one of the more commonly used in information theory and unlike costs and distance this one works on binary vectors only.

Hamming distance is a primarily used to compare sent signal and received signal and it tries to identify any changes that may have occurred in a send signal. If hamming distance of two vectors is zero, the vectors are identical. And as you may assume from the picture here, It works by counting errors between two vectors. In this example, right here we have 123 errors. So the hamming distance of these two vectors is free. The implementation of the hamming distance function is the same as we had in the course in distance.

So let's copy it and paste it in the hamming distance function. The only change that we have to make is to change the cosine to Hamming. And as you can see, it takes u and v factors as well, so we don't have to change anything there. And that's it for this video. If you have any questions or comments so far, please post them in the comment section. Otherwise, I see you in the next tutorial.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.