Question

In: Computer Science

For binary data, the L1 distance corresponds to the Hamming distance; that is, the number of...

For binary data, the L1 distance corresponds to the Hamming distance; that is, the number of bits that are different between two binary vectors. For the following two binary vectors, compute:

X = 10011011

Y = 01011000

1 - Hamming distance

2 - Jaccard Similarity Coefficient (JSC) and Simple Matching Coefficient (SMC)

3 - Cosine Similarity

4 - L2 (Euclidean) and L∞ (Supermum) distances

5 - Correlation between X and Y

Solutions

Expert Solution

Answer- (the question is lengthy, so as per guidelines i am answering first four parts)

given,

X = 10011011

Y = 01011000

1.

Hamming distance- (the number of bits that are different between two binary vectors)  = 4

------------------------------------------------------

2.

Jaccard Similarity Coefficient (JSC) and Simple Matching Coefficient (SMC)

For computing the similaritie we need following quantities,

B01 = no. of attributes where X is 0 and Y is 1

B10 = no. of attributes where X is 1 and Y is 0

B00 = no. of attributes where X is 0 and Y is 0

B11 = no. of attributes where X is 1 and Y is 1

X 1 0 0 1 1 0 1 1
Y 0 1 0 1 1 0 0 0

B01 = 1 B10 = 3 B11= 2 B00 = 2

Jaccard Similarity Coefficient (JSC)= J = no. of 11 matches / no. of not-both-zero attributes values

J= (B11) / (B01 + B10+ B11) = 2/6 = 0.33

Simple Matching Coefficient (SMC)= number of matches / number of attributes

SMC = (B11 + B00) / (B01 + B10+ B11 + B00) = 4/8 = 0.5

-------------------------------------------------

3.

Cosine Similarity-If X and Y are two binary vectors ,then

Cos (X, Y) = (X.Y) / ( ||X|| ||Y|| ) , where . (dot) indicates dot product, ||X|| indicates length of vector X

Here, X.Y= (1.0 + 0.1 + 0.0 + 1.1 + 1.1 + 0.0 + 1.0 + 1.0) = 2

||X|| = ( 1*1 + 0*0 + 0*0 + 1*1 + 1*1 + 0*0 + 1*1 + 1*1)1/2 = (5 )1/2 = 2.24

||Y|| = (0*0 + 1*1 + 0*0 + 1*1 + 1*1 + 0*0 + 0*0 + 0*0)1/2 = (3)1/2 = 1.73

Cosine Similarity = 2/ ( 2.24 X 1.73) = 0.516

-----------------------------------------------

4.

L2 (Euclidean)


Related Solutions

In python. Write a program that takes 2 string inputs and calculates the Hamming Distance. Hamming...
In python. Write a program that takes 2 string inputs and calculates the Hamming Distance. Hamming distance between two strings is the number of positions at which the corresponding symbols are different. The program should output an integer representing this distance. For example a = XXWWZZ b = ZZWWXX answer = 4 More examples: "Phone" and "PHOONE" = 3 "God" and "Dog" = 2 "Dog" and "House" = 4
Python(please take a screen shot!): 1. hamming distance: write a function distance that take two bits...
Python(please take a screen shot!): 1. hamming distance: write a function distance that take two bits strings, you can assume each strings only contains 0's and 1's. (Note: the two strings might have the same length or not!) for example: hamming('010001001111', '01010100') should return 5(1 bit changed plus 4 bits "lost" from the end). 2. write a main function that ask user for two file names, open files and read the 1st line of each, and compares them using Hamming...
This question is about the Hamming distance (HD). Given a reference DNA sequence and a set...
This question is about the Hamming distance (HD). Given a reference DNA sequence and a set of candidate sequences, you are going to find out which candidate(s) has/have the Hamming distance smaller or equal to a threshold k. e.g. Reference DNA: AATGCGC Candidate 1: AATCCCC Candidate 2: TTTGCTC Candidate 3: AATAAAA If the Hamming distance threshold k = 3: HD1 = 2 HD2 = 3 HD3 = 4 Your result should return a list of all the qualified candidate numbers...
Please show me how to do the following: a.)   Given a binary signal calculate the hamming...
Please show me how to do the following: a.)   Given a binary signal calculate the hamming code. b.)   Given a hamming code with an error, show how to find where the error is and correct it.
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code requirements. Illustrate the error detection and correction scheme using Hamming code method, for both the sender and receiver to detect an error at the following positions: a.6thbit position. b.11thbit position.Assume an odd-parity scheme for this problem.
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code...
Given the data-bits m = 11010110, determine the number of k (parity-bits) by using Hamming Code requirements. Illustrate the error detection and correction scheme using Hamming code method, for both the sender and receiver to detect an error at the following positions: a. 6th bit position. b. 11th bit position. Assume an odd-parity scheme for this problem.
Let L1 be the language of the binary representations of all positive integers divisible by 4....
Let L1 be the language of the binary representations of all positive integers divisible by 4. Let L2 be the language of the binary representations of all positive integers not divisible by 4. None of the elements of these languages have leading zeroes. a) Write a regular expression denoting L1. b) Write a regular expression denoting L2. c) a) Draw a state diagram (= deterministic finite state automaton) with as few states as possible which recognizes L1. This state diagram...
Write pseudocode for an algorithm that calculates the Hamming distance between two strings s1 and s2...
Write pseudocode for an algorithm that calculates the Hamming distance between two strings s1 and s2 of the same length n. What is the complexity of your algorithm?
Write pseudocode for an algorithm that calculates the Hamming distance between two strings s1 and s2...
Write pseudocode for an algorithm that calculates the Hamming distance between two strings s1 and s2 of the same length n. What is the complexity of your algorithm?
I'm trying to code in MIPS (MIPS Assembly Language) to calculate the hamming distance between two...
I'm trying to code in MIPS (MIPS Assembly Language) to calculate the hamming distance between two integers. Ideally, the program would ask for the user to type in the two integers. Then, the program would calculate the hamming distance. Afterward, it would ask if you'd like to find another hamming distance. If the user says yes, it would loop back to the beginning and ask for two new integers. Below is the code that I've created so far. Guidance with...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT