3. (This exercise is a variation of Exercise 2.8 in Chapter 2 of the textbook) C
ID: 3072477 • Letter: 3
Question
3. (This exercise is a variation of Exercise 2.8 in Chapter 2 of the textbook) Consider the data as 2-D data points. Given a new data point x (1.4, 1.6) as a query, rank the database points based on the cosine similarity measure A2 x1 1.51.7 1.9 1.6 1.8 1.2 1.5 X2 2 X 1.5 In other words, find the cosine similarity for each data point and sort in decreasing order Similarity Closest Second closest Third closest Fourth closest Farthest Vector 4. (This exercise is a variation of Exercise 3.3 in Chapter 3 of the textbook) Using the data set given in Exercise 1 of this assignment, use smoothing by bin means to smooth this data, using a bin depth of 3 Round results to two decimal places Bins Smoothed by Bin MeansExplanation / Answer
We have given new data point X = c(1.4, 1.6)
Also we have given data set,
A1 A2
X1 1.5 1.7
X 2 2 1.9
X3 1.6 1.8
X4 1.2 1.5
X5 1.5 1
Now we compute a distance of each data point in given data set from the new data point X = c(1.4,1.6) using euclidian distance formula.
i.e. distance of X from X1 is sqrt((1.5-1.4)^2 + (1.7-1.6)^2) = 0.1414
distance of X from X2 is sqrt((2-1.4)^2 + (1.9-1.6)^2) = 0.6708
distance of X from X3 is sqrt((1.6-1.4)^2 + (1.8-1.6)^2) = 0.2828
distance of X from X4 is sqrt((1.2-1.4)^2 + (1.5-1.6)^2) = 0.2236
distance of X from X5 is sqrt((1.5-1.4)^2 + (1-1.6)^2) = 0.6083
Hence cosine similarity for each data point is,
Similarity Vector
Closest X1
Second CLosest X4
Third Closest X3
Fourth Closest X5
Fifth CLosest X2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.