SlideShare uma empresa Scribd logo
1 de 6
Baixar para ler offline
Subject: Perspective in Informatics 3 – Fall Semester 2014
Professor: Davood Rafiei
Assignment No.1 HOANG Nguyen Phong
Submitted on November 3rd ID number: 6930-26-1264
Question 1 [30 marks]
• 3.5.1: on the space of nonnegative integers, which of the following functions are
distance measures? If so, prove it; if not, prove that it fails to satisfy one or more of the
axioms.
a) max(x, y) = the larger of x and y.
This function is distance measure function because of the following reasons:
• In the space of nonnegative integers as given from the beginning, the function would
never return a negative value.
• If x and y are at the same position in the space, then no larger value is defined, which
would return a null value (which is 0). That satisfies the reflexive property of distance
measure function.
• Measuring both distances from x to y and x < y, and from y to x would only return one
larger value. It satisfies the symmetric property of distance measure function.
• Let x and y are 2 separate nodes, and a is a random node (different from x and y).
Then, the triangle-inequality can be proved as shown in the below table:
3 Possible cases of a max(x,a) + max(y,a) > max(x,y) Check
a ∈ [x,y] a + y ≥ y true
a < (x,y) x + y ≥ y true
a > (x,y) a + a ≥ y true(since a≥y => 2a≥y)
• Actually, this function is the L∞-norm Euclidean distance measuring function, which is
used when x and y have many dimensions (where the dimension ~> ∞). Then, the
distance between x and y is approximately equal to the max(x,y).
b) diff(x, y) = |x − y| (the absolute magnitude of the difference between x and y).
• By proving in the same manner of the above case, this function is also a distance
measure function, because of the following reasons:
• Since the absolute-value function, it would always return a nonnegative value.
• If x and y is a same point, the function will return 0. That satisfies the reflexive
property.
• Let x and y are 2 separate nodes, and a is a random node (different from x and y).
Then, the triangle-inequality can be proved as shown in the below table:
3 Possible cases of a diff(x,a) + diff(y,a) > diff(x,y) Check
a ∈ [x,y]
(a – x) + (y – a) ≥ y – x
 y – x ≥ y – x
true
a < (x,y)
(x – a) + (y – a) > y – x
 x + y – 2a > y – x
 x > a
true (since a<x as given in
the initial condition of a )
a > (x,y) a + a > y
true(since a>y as given in
the initial condition of a
=> 2a>y)
• Actually, we can imagine that this function is a L1-norm Euclidean Distance function
for measuring x and y in 1 dimension.
c) sum(x, y) = x + y.
It is easily proved that this function is not a distance measure function, since it does not
satisfies the reflexive property. For instance, if x and y are a same point (≠0), the function
would return a positive value in lieu of 0 because they are both in nonnegative space.
1
Subject: Perspective in Informatics 3 – Fall Semester 2014
Professor: Davood Rafiei
• 3.7.2: Let us compute sketches using the following four “random” vectors:
V1= [+1,+1,+1,-1] V2=[+1,+1,-1,+1]
V3=[+1,-1,+1,+1] V4=[-1,+1,+1,+1]
Compute the sketches of the following vectors.
• [2,3,4,5]
Random vector Dot product Sketch value
V1= [+1,+1,+1,-1] 4 +1
V2=[+1,+1,-1,+1] 6 +1
V3=[+1,-1,+1,+1] 8 +1
V4=[-1,+1,+1,+1] 10 +1
(b)[-2,3,-4,5]
Random vector Dot product Sketch value
V1= [+1,+1,+1,-1] -8 -1
V2=[+1,+1,-1,+1] 10 +1
V3=[+1,-1,+1,+1] -4 -1
V4=[-1,+1,+1,+1] 6 +1
(c)[2,-3,4,-5]
Random vector Dot product Sketch value
V1= [+1,+1,+1,-1] 8 +1
V2=[+1,+1,-1,+1] -10 -1
V3=[+1,-1,+1,+1] 4 +1
V4=[-1,+1,+1,+1] -6 -1
For each pair, what is the estimated angle between them, according to the sketches? What are
the true angles?
The following 2 formulas are employed to calculate the Estimated angle and true angles:
• Estimated angle = 180O(1 – sim( Sketches of 2 vectors))
• True Angle =
𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷(𝑡𝑡ℎ𝑒𝑒 2 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣)
𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚 𝑜𝑜𝑜𝑜 𝑡𝑡ℎ𝑒𝑒 2 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣
Pair Estimated angle True angles
∠ (a)(b) 90o 90o-15o=75o
∠ (b)(c) 180o 180o
∠ (a)(c) 90o 90o+15o=105o
• 3.7.3: suppose we form sketches by using all sixteen of the vectors of length 4, whose
components are each +1 or -1. Compute the sketches of the three vectors in Exercise
3.7.2.
*at dot product = 0, sketch value is randomly chosen to be 1 or +1 as highlighted in gray.
2
Subject: Perspective in Informatics 3 – Fall Semester 2014
Professor: Davood Rafiei
Vector a 2 3 4 5
Random vector dot Product Sketch value
v1 -1 -1 -1 -1 -14 -1
v2 -1 -1 -1 1 -4 -1
v3 -1 -1 1 -1 -6 -1
v4 -1 -1 1 1 4 1
v5 -1 1 -1 -1 -8 -1
v6 -1 1 -1 1 2 1
v7 -1 1 1 -1 0 1
v8 -1 1 1 1 10 1
v9 1 -1 -1 -1 -10 -1
v10 1 -1 -1 1 0 -1
v11 1 -1 1 -1 -2 -1
v12 1 -1 1 1 8 1
v13 1 1 -1 -1 -4 -1
v14 1 1 -1 1 6 1
v15 1 1 1 -1 4 1
v16 1 1 1 1 14 1
Vector b -2 3 -4 5
Random vector dot Product Sketch value
v1 -1 -1 -1 -1 -2 -1
v2 -1 -1 -1 1 8 1
v3 -1 -1 1 -1 -10 -1
v4 -1 -1 1 1 0 -1
v5 -1 1 -1 -1 4 1
v6 -1 1 -1 1 14 1
v7 -1 1 1 -1 -4 -1
v8 -1 1 1 1 6 1
v9 1 -1 -1 -1 -6 -1
v10 1 -1 -1 1 4 1
v11 1 -1 1 -1 -14 -1
v12 1 -1 1 1 -4 -1
v13 1 1 -1 -1 0 1
v14 1 1 -1 1 10 1
v15 1 1 1 -1 -8 -1
v16 1 1 1 1 2 1
3
Subject: Perspective in Informatics 3 – Fall Semester 2014
Professor: Davood Rafiei
Vector c 2 -3 4 -5
Random vector dot Product Sketch value
v1 -1 -1 -1 -1 2 1
v2 -1 -1 -1 1 -8 -1
v3 -1 -1 1 -1 10 1
v4 -1 -1 1 1 0 1
v5 -1 1 -1 -1 -4 -1
v6 -1 1 -1 1 -14 -1
v7 -1 1 1 -1 4 1
v8 -1 1 1 1 -6 -1
v9 1 -1 -1 -1 6 1
v10 1 -1 -1 1 -4 -1
v11 1 -1 1 -1 14 1
v12 1 -1 1 1 4 1
v13 1 1 -1 -1 0 -1
v14 1 1 -1 1 -10 -1
v15 1 1 1 -1 8 1
v16 1 1 1 1 -2 -1
How do the estimates of the angles between each pair compare with the true angles?
Pair Estimated angle True angles
∠ (a)(b) ½ => 90o 90o-15o=75o
∠ (b)(c) 11/12 => approximate 180o 180o
∠ (a)(c) ½ => 90o 90o+15o=105o
Then it can be deduced that even all of 16 random vectors are chosen, the estimates of the
angles between each pair compare with the true angles do not change compared with the result
in problem 3.7.2.
4
Subject: Perspective in Informatics 3 – Fall Semester 2014
Professor: Davood Rafiei
Question 2 [10 marks] 3.7.4(A): Suppose we form sketches using the four vectors from
Exercise 3.7.2. What are the constrains on a, b, c, and d that will cause the sketch of the vector
[a, b, c, d] to be [+1,+1,+1,+1]? (write your constrains in as simple form as possible)
The dot products of four random vectors and [a, b, c, d] can be represented in form of matrix as
following equation:
�
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
�。 �
𝑎𝑎
𝑏𝑏
𝑐𝑐
𝑑𝑑
� = �
𝑥𝑥1
𝑥𝑥2
𝑥𝑥3
𝑥𝑥4
�
the sketch of [a, b, c, d] is [+1 , +1, +1, +1] where all of x1,x2,x3,x4 ≥ 0
�
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
�
−1
�
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
�。 �
𝑎𝑎
𝑏𝑏
𝑐𝑐
𝑑𝑑
� = �
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
�
−1
�
𝑥𝑥1
𝑥𝑥2
𝑥𝑥3
𝑥𝑥4
�
�
𝑎𝑎
𝑏𝑏
𝑐𝑐
𝑑𝑑
� = �
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
�
−1
�
𝑥𝑥1
𝑥𝑥2
𝑥𝑥3
𝑥𝑥4
�
We have�
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
�
−1
=
1
4
�
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
�
So a, b, a and d can be constrained by the following equation:
�
𝑎𝑎
𝑏𝑏
𝑐𝑐
𝑑𝑑
� =
1
4
�
1 1 1 −1
1 1 −1 1
1 −1 1 1
−1 1 1 1
� �
𝑥𝑥1
𝑥𝑥2
𝑥𝑥3
𝑥𝑥4
� where x1,x2,x3,x4 ≥ 0�
𝑎𝑎 + 𝑏𝑏 + 𝑐𝑐 − 𝑑𝑑 ≥ 0
𝑎𝑎 + 𝑏𝑏 − 𝑐𝑐 + 𝑑𝑑 ≥ 0
𝑎𝑎 − 𝑏𝑏 + 𝑐𝑐 + 𝑑𝑑 ≥ 0
−𝑎𝑎 + 𝑏𝑏 + 𝑐𝑐 + 𝑑𝑑 ≥ 0
5
Subject: Perspective in Informatics 3 – Fall Semester 2014
Professor: Davood Rafiei
Question 3 [10 marks]
a) Consider a universe U with n elements, and let R and S be subsets of U both of size m,
chosen uniformly at random.
What is the expected value of the Jaccard similarity of R and S?
The Expectation of an event x is calculated as Ε(x) = ∑x. P(x)
In this case, Jaccard Similarity of R and S is calculated as:
Sim(R,S)=
|𝑅𝑅⋂𝑆𝑆|
|𝑅𝑅⋃𝑆𝑆|
=
𝑘𝑘
2𝑚𝑚−𝑘𝑘
(𝑤𝑤ℎ𝑒𝑒𝑒𝑒𝑒𝑒 0 ≤ 𝑘𝑘 ≤ 𝑚𝑚 𝑖𝑖𝑖𝑖 𝑡𝑡ℎ𝑒𝑒 𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 𝑜𝑜𝑜𝑜 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑒𝑒𝑒𝑒𝑒𝑒 𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑅𝑅 𝑎𝑎𝑎𝑎𝑎𝑎 𝑆𝑆)
Next, the probability of Sim(R,S) is calculated as following:
P(sim(R,S)=(
𝑘𝑘
2𝑚𝑚−𝑘𝑘
))=
𝐶𝐶 𝑚𝑚
𝑘𝑘 𝐶𝐶𝑛𝑛−𝑚𝑚
𝑚𝑚−𝑘𝑘
𝐶𝐶𝑛𝑛
𝑚𝑚
Since:
• To create set R, we combine m element(s) from n elements of the universal set U. It is
calculated as: 𝐶𝐶𝑛𝑛
𝑚𝑚
• Next, to create set S, we need to take k common element(s) from set R first, which is
calculated as 𝐶𝐶𝑚𝑚
𝑘𝑘
. Then the left (m-k) element(s) are chosen from (n-m) elements, since
m element(s) have been chosen to create set R at the beginning. The formula is:
𝐶𝐶𝑛𝑛−𝑚𝑚
𝑚𝑚−𝑘𝑘
As a result, Expectation of Jaccard Similarity sim(S,T) is estimated as:
E(sim(S,T))=∑
𝑘𝑘
2𝑚𝑚−𝑘𝑘
𝐶𝐶 𝑚𝑚
𝑘𝑘
𝐶𝐶𝑛𝑛−𝑚𝑚
𝑚𝑚−𝑘𝑘
𝐶𝐶𝑛𝑛
𝑚𝑚 =𝑚𝑚
𝑘𝑘=0 ∑
𝑘𝑘
2𝑚𝑚−𝑘𝑘
�
𝑚𝑚
𝑘𝑘��
𝑛𝑛−𝑚𝑚
𝑚𝑚−𝑘𝑘�
� 𝑛𝑛
𝑚𝑚�
𝑚𝑚
𝑘𝑘=0
b) How does your answer to part (a) change if R and S must include a certain element (say z)
of U?
It means k ~> z, then the answer is changed to be:
E(sim(S,T))=∑
𝑧𝑧
2𝑚𝑚−𝑧𝑧
𝐶𝐶 𝑚𝑚
𝑧𝑧
𝐶𝐶𝑛𝑛−𝑚𝑚
𝑚𝑚−𝑧𝑧
𝐶𝐶𝑛𝑛
𝑚𝑚 =𝑧𝑧
𝑘𝑘=0 ∑
𝑧𝑧
2𝑚𝑚−𝑧𝑧
� 𝑚𝑚
𝑧𝑧 �� 𝑛𝑛−𝑚𝑚
𝑚𝑚−𝑧𝑧�
� 𝑛𝑛
𝑚𝑚�
𝑧𝑧
𝑘𝑘=0
c) How does your answer to part (a) change if R and S must be disjoint?
It means k=0, then the answer is changed to be:
E(sim(S,T))=∑
𝑘𝑘
2𝑚𝑚−𝑘𝑘
𝐶𝐶 𝑚𝑚
𝑘𝑘
𝐶𝐶𝑛𝑛−𝑚𝑚
𝑚𝑚−𝑘𝑘
𝐶𝐶𝑛𝑛
𝑚𝑚 =0
𝑘𝑘=0 0
6

Mais conteúdo relacionado

Mais procurados

1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
NAVER Engineering
 

Mais procurados (20)

Demonstrate interpolation search
Demonstrate interpolation searchDemonstrate interpolation search
Demonstrate interpolation search
 
Multiple integrals
Multiple integralsMultiple integrals
Multiple integrals
 
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
1시간만에 GAN(Generative Adversarial Network) 완전 정복하기
 
Generalized Nonlinear Models in R
Generalized Nonlinear Models in RGeneralized Nonlinear Models in R
Generalized Nonlinear Models in R
 
Lesson 16: Derivatives of Exponential and Logarithmic Functions
Lesson 16: Derivatives of Exponential and Logarithmic FunctionsLesson 16: Derivatives of Exponential and Logarithmic Functions
Lesson 16: Derivatives of Exponential and Logarithmic Functions
 
Lesson 22: Optimization Problems (slides)
Lesson 22: Optimization Problems (slides)Lesson 22: Optimization Problems (slides)
Lesson 22: Optimization Problems (slides)
 
Section 10: Lagrange's Theorem
Section 10: Lagrange's TheoremSection 10: Lagrange's Theorem
Section 10: Lagrange's Theorem
 
Marge Sort
Marge SortMarge Sort
Marge Sort
 
Newton divided difference interpolation
Newton divided difference interpolationNewton divided difference interpolation
Newton divided difference interpolation
 
Ridge regression
Ridge regressionRidge regression
Ridge regression
 
Ridge regression, lasso and elastic net
Ridge regression, lasso and elastic netRidge regression, lasso and elastic net
Ridge regression, lasso and elastic net
 
Dimensionality reduction: SVD and its applications
Dimensionality reduction: SVD and its applicationsDimensionality reduction: SVD and its applications
Dimensionality reduction: SVD and its applications
 
Probability Density Function (PDF)
Probability Density Function (PDF)Probability Density Function (PDF)
Probability Density Function (PDF)
 
Functions in discrete mathematics
Functions in discrete mathematicsFunctions in discrete mathematics
Functions in discrete mathematics
 
Gamma function
Gamma functionGamma function
Gamma function
 
Graph Theory
Graph TheoryGraph Theory
Graph Theory
 
Faster R-CNN - PR012
Faster R-CNN - PR012Faster R-CNN - PR012
Faster R-CNN - PR012
 
Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)Counting sort(Non Comparison Sort)
Counting sort(Non Comparison Sort)
 
Numerical Methods - Oridnary Differential Equations - 2
Numerical Methods - Oridnary Differential Equations - 2Numerical Methods - Oridnary Differential Equations - 2
Numerical Methods - Oridnary Differential Equations - 2
 
Merge sort
Merge sortMerge sort
Merge sort
 

Semelhante a Perspective in Informatics 3 - Assignment 1 - Answer Sheet

chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
54MahakBansal
 
April 10, 2015
April 10, 2015April 10, 2015
April 10, 2015
khyps13
 

Semelhante a Perspective in Informatics 3 - Assignment 1 - Answer Sheet (20)

Unit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithmsUnit-2 raster scan graphics,line,circle and polygon algorithms
Unit-2 raster scan graphics,line,circle and polygon algorithms
 
Proyecto grupal algebra parcial ii
Proyecto grupal algebra parcial iiProyecto grupal algebra parcial ii
Proyecto grupal algebra parcial ii
 
Vectores clase2
Vectores clase2Vectores clase2
Vectores clase2
 
The Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math PrimerThe Day You Finally Use Algebra: A 3D Math Primer
The Day You Finally Use Algebra: A 3D Math Primer
 
M01L01 Advance Engineering Mathematics.pptx
M01L01 Advance Engineering Mathematics.pptxM01L01 Advance Engineering Mathematics.pptx
M01L01 Advance Engineering Mathematics.pptx
 
Motion in a plane
Motion in a planeMotion in a plane
Motion in a plane
 
Chapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptxChapter 3 - Part 1 [Autosaved].pptx
Chapter 3 - Part 1 [Autosaved].pptx
 
Nonparametric approach to multiple regression
Nonparametric approach to multiple regressionNonparametric approach to multiple regression
Nonparametric approach to multiple regression
 
Ch4
Ch4Ch4
Ch4
 
Fst ch2 notes
Fst ch2 notesFst ch2 notes
Fst ch2 notes
 
GATE Engineering Maths : Vector Calculus
GATE Engineering Maths : Vector CalculusGATE Engineering Maths : Vector Calculus
GATE Engineering Maths : Vector Calculus
 
Matrix algebra in_r
Matrix algebra in_rMatrix algebra in_r
Matrix algebra in_r
 
Lesson 1: Vectors and Scalars
Lesson 1: Vectors and ScalarsLesson 1: Vectors and Scalars
Lesson 1: Vectors and Scalars
 
Fst ch3 notes
Fst ch3 notesFst ch3 notes
Fst ch3 notes
 
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohichapter 3 , foley.pptxhuujjjjjjjkjmmmm.  Ibibhvucufucuvivihohi
chapter 3 , foley.pptxhuujjjjjjjkjmmmm. Ibibhvucufucuvivihohi
 
April 10, 2015
April 10, 2015April 10, 2015
April 10, 2015
 
B.Tech-II_Unit-V
B.Tech-II_Unit-VB.Tech-II_Unit-V
B.Tech-II_Unit-V
 
Matlab polynimials and curve fitting
Matlab polynimials and curve fittingMatlab polynimials and curve fitting
Matlab polynimials and curve fitting
 
IVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdf
IVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdfIVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdf
IVS-B UNIT-1_merged. Semester 2 fundamental of sciencepdf
 
Cg 04-math
Cg 04-mathCg 04-math
Cg 04-math
 

Último

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 

Perspective in Informatics 3 - Assignment 1 - Answer Sheet

  • 1. Subject: Perspective in Informatics 3 – Fall Semester 2014 Professor: Davood Rafiei Assignment No.1 HOANG Nguyen Phong Submitted on November 3rd ID number: 6930-26-1264 Question 1 [30 marks] • 3.5.1: on the space of nonnegative integers, which of the following functions are distance measures? If so, prove it; if not, prove that it fails to satisfy one or more of the axioms. a) max(x, y) = the larger of x and y. This function is distance measure function because of the following reasons: • In the space of nonnegative integers as given from the beginning, the function would never return a negative value. • If x and y are at the same position in the space, then no larger value is defined, which would return a null value (which is 0). That satisfies the reflexive property of distance measure function. • Measuring both distances from x to y and x < y, and from y to x would only return one larger value. It satisfies the symmetric property of distance measure function. • Let x and y are 2 separate nodes, and a is a random node (different from x and y). Then, the triangle-inequality can be proved as shown in the below table: 3 Possible cases of a max(x,a) + max(y,a) > max(x,y) Check a ∈ [x,y] a + y ≥ y true a < (x,y) x + y ≥ y true a > (x,y) a + a ≥ y true(since a≥y => 2a≥y) • Actually, this function is the L∞-norm Euclidean distance measuring function, which is used when x and y have many dimensions (where the dimension ~> ∞). Then, the distance between x and y is approximately equal to the max(x,y). b) diff(x, y) = |x − y| (the absolute magnitude of the difference between x and y). • By proving in the same manner of the above case, this function is also a distance measure function, because of the following reasons: • Since the absolute-value function, it would always return a nonnegative value. • If x and y is a same point, the function will return 0. That satisfies the reflexive property. • Let x and y are 2 separate nodes, and a is a random node (different from x and y). Then, the triangle-inequality can be proved as shown in the below table: 3 Possible cases of a diff(x,a) + diff(y,a) > diff(x,y) Check a ∈ [x,y] (a – x) + (y – a) ≥ y – x  y – x ≥ y – x true a < (x,y) (x – a) + (y – a) > y – x  x + y – 2a > y – x  x > a true (since a<x as given in the initial condition of a ) a > (x,y) a + a > y true(since a>y as given in the initial condition of a => 2a>y) • Actually, we can imagine that this function is a L1-norm Euclidean Distance function for measuring x and y in 1 dimension. c) sum(x, y) = x + y. It is easily proved that this function is not a distance measure function, since it does not satisfies the reflexive property. For instance, if x and y are a same point (≠0), the function would return a positive value in lieu of 0 because they are both in nonnegative space. 1
  • 2. Subject: Perspective in Informatics 3 – Fall Semester 2014 Professor: Davood Rafiei • 3.7.2: Let us compute sketches using the following four “random” vectors: V1= [+1,+1,+1,-1] V2=[+1,+1,-1,+1] V3=[+1,-1,+1,+1] V4=[-1,+1,+1,+1] Compute the sketches of the following vectors. • [2,3,4,5] Random vector Dot product Sketch value V1= [+1,+1,+1,-1] 4 +1 V2=[+1,+1,-1,+1] 6 +1 V3=[+1,-1,+1,+1] 8 +1 V4=[-1,+1,+1,+1] 10 +1 (b)[-2,3,-4,5] Random vector Dot product Sketch value V1= [+1,+1,+1,-1] -8 -1 V2=[+1,+1,-1,+1] 10 +1 V3=[+1,-1,+1,+1] -4 -1 V4=[-1,+1,+1,+1] 6 +1 (c)[2,-3,4,-5] Random vector Dot product Sketch value V1= [+1,+1,+1,-1] 8 +1 V2=[+1,+1,-1,+1] -10 -1 V3=[+1,-1,+1,+1] 4 +1 V4=[-1,+1,+1,+1] -6 -1 For each pair, what is the estimated angle between them, according to the sketches? What are the true angles? The following 2 formulas are employed to calculate the Estimated angle and true angles: • Estimated angle = 180O(1 – sim( Sketches of 2 vectors)) • True Angle = 𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷𝐷(𝑡𝑡ℎ𝑒𝑒 2 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣) 𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚𝑚 𝑜𝑜𝑜𝑜 𝑡𝑡ℎ𝑒𝑒 2 𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣𝑣 Pair Estimated angle True angles ∠ (a)(b) 90o 90o-15o=75o ∠ (b)(c) 180o 180o ∠ (a)(c) 90o 90o+15o=105o • 3.7.3: suppose we form sketches by using all sixteen of the vectors of length 4, whose components are each +1 or -1. Compute the sketches of the three vectors in Exercise 3.7.2. *at dot product = 0, sketch value is randomly chosen to be 1 or +1 as highlighted in gray. 2
  • 3. Subject: Perspective in Informatics 3 – Fall Semester 2014 Professor: Davood Rafiei Vector a 2 3 4 5 Random vector dot Product Sketch value v1 -1 -1 -1 -1 -14 -1 v2 -1 -1 -1 1 -4 -1 v3 -1 -1 1 -1 -6 -1 v4 -1 -1 1 1 4 1 v5 -1 1 -1 -1 -8 -1 v6 -1 1 -1 1 2 1 v7 -1 1 1 -1 0 1 v8 -1 1 1 1 10 1 v9 1 -1 -1 -1 -10 -1 v10 1 -1 -1 1 0 -1 v11 1 -1 1 -1 -2 -1 v12 1 -1 1 1 8 1 v13 1 1 -1 -1 -4 -1 v14 1 1 -1 1 6 1 v15 1 1 1 -1 4 1 v16 1 1 1 1 14 1 Vector b -2 3 -4 5 Random vector dot Product Sketch value v1 -1 -1 -1 -1 -2 -1 v2 -1 -1 -1 1 8 1 v3 -1 -1 1 -1 -10 -1 v4 -1 -1 1 1 0 -1 v5 -1 1 -1 -1 4 1 v6 -1 1 -1 1 14 1 v7 -1 1 1 -1 -4 -1 v8 -1 1 1 1 6 1 v9 1 -1 -1 -1 -6 -1 v10 1 -1 -1 1 4 1 v11 1 -1 1 -1 -14 -1 v12 1 -1 1 1 -4 -1 v13 1 1 -1 -1 0 1 v14 1 1 -1 1 10 1 v15 1 1 1 -1 -8 -1 v16 1 1 1 1 2 1 3
  • 4. Subject: Perspective in Informatics 3 – Fall Semester 2014 Professor: Davood Rafiei Vector c 2 -3 4 -5 Random vector dot Product Sketch value v1 -1 -1 -1 -1 2 1 v2 -1 -1 -1 1 -8 -1 v3 -1 -1 1 -1 10 1 v4 -1 -1 1 1 0 1 v5 -1 1 -1 -1 -4 -1 v6 -1 1 -1 1 -14 -1 v7 -1 1 1 -1 4 1 v8 -1 1 1 1 -6 -1 v9 1 -1 -1 -1 6 1 v10 1 -1 -1 1 -4 -1 v11 1 -1 1 -1 14 1 v12 1 -1 1 1 4 1 v13 1 1 -1 -1 0 -1 v14 1 1 -1 1 -10 -1 v15 1 1 1 -1 8 1 v16 1 1 1 1 -2 -1 How do the estimates of the angles between each pair compare with the true angles? Pair Estimated angle True angles ∠ (a)(b) ½ => 90o 90o-15o=75o ∠ (b)(c) 11/12 => approximate 180o 180o ∠ (a)(c) ½ => 90o 90o+15o=105o Then it can be deduced that even all of 16 random vectors are chosen, the estimates of the angles between each pair compare with the true angles do not change compared with the result in problem 3.7.2. 4
  • 5. Subject: Perspective in Informatics 3 – Fall Semester 2014 Professor: Davood Rafiei Question 2 [10 marks] 3.7.4(A): Suppose we form sketches using the four vectors from Exercise 3.7.2. What are the constrains on a, b, c, and d that will cause the sketch of the vector [a, b, c, d] to be [+1,+1,+1,+1]? (write your constrains in as simple form as possible) The dot products of four random vectors and [a, b, c, d] can be represented in form of matrix as following equation: � 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 �。 � 𝑎𝑎 𝑏𝑏 𝑐𝑐 𝑑𝑑 � = � 𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 � the sketch of [a, b, c, d] is [+1 , +1, +1, +1] where all of x1,x2,x3,x4 ≥ 0 � 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 � −1 � 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 �。 � 𝑎𝑎 𝑏𝑏 𝑐𝑐 𝑑𝑑 � = � 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 � −1 � 𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 � � 𝑎𝑎 𝑏𝑏 𝑐𝑐 𝑑𝑑 � = � 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 � −1 � 𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 � We have� 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 � −1 = 1 4 � 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 � So a, b, a and d can be constrained by the following equation: � 𝑎𝑎 𝑏𝑏 𝑐𝑐 𝑑𝑑 � = 1 4 � 1 1 1 −1 1 1 −1 1 1 −1 1 1 −1 1 1 1 � � 𝑥𝑥1 𝑥𝑥2 𝑥𝑥3 𝑥𝑥4 � where x1,x2,x3,x4 ≥ 0� 𝑎𝑎 + 𝑏𝑏 + 𝑐𝑐 − 𝑑𝑑 ≥ 0 𝑎𝑎 + 𝑏𝑏 − 𝑐𝑐 + 𝑑𝑑 ≥ 0 𝑎𝑎 − 𝑏𝑏 + 𝑐𝑐 + 𝑑𝑑 ≥ 0 −𝑎𝑎 + 𝑏𝑏 + 𝑐𝑐 + 𝑑𝑑 ≥ 0 5
  • 6. Subject: Perspective in Informatics 3 – Fall Semester 2014 Professor: Davood Rafiei Question 3 [10 marks] a) Consider a universe U with n elements, and let R and S be subsets of U both of size m, chosen uniformly at random. What is the expected value of the Jaccard similarity of R and S? The Expectation of an event x is calculated as Ε(x) = ∑x. P(x) In this case, Jaccard Similarity of R and S is calculated as: Sim(R,S)= |𝑅𝑅⋂𝑆𝑆| |𝑅𝑅⋃𝑆𝑆| = 𝑘𝑘 2𝑚𝑚−𝑘𝑘 (𝑤𝑤ℎ𝑒𝑒𝑒𝑒𝑒𝑒 0 ≤ 𝑘𝑘 ≤ 𝑚𝑚 𝑖𝑖𝑖𝑖 𝑡𝑡ℎ𝑒𝑒 𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛𝑛 𝑜𝑜𝑜𝑜 𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐𝑐 𝑒𝑒𝑒𝑒𝑒𝑒 𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏𝑏 𝑅𝑅 𝑎𝑎𝑎𝑎𝑎𝑎 𝑆𝑆) Next, the probability of Sim(R,S) is calculated as following: P(sim(R,S)=( 𝑘𝑘 2𝑚𝑚−𝑘𝑘 ))= 𝐶𝐶 𝑚𝑚 𝑘𝑘 𝐶𝐶𝑛𝑛−𝑚𝑚 𝑚𝑚−𝑘𝑘 𝐶𝐶𝑛𝑛 𝑚𝑚 Since: • To create set R, we combine m element(s) from n elements of the universal set U. It is calculated as: 𝐶𝐶𝑛𝑛 𝑚𝑚 • Next, to create set S, we need to take k common element(s) from set R first, which is calculated as 𝐶𝐶𝑚𝑚 𝑘𝑘 . Then the left (m-k) element(s) are chosen from (n-m) elements, since m element(s) have been chosen to create set R at the beginning. The formula is: 𝐶𝐶𝑛𝑛−𝑚𝑚 𝑚𝑚−𝑘𝑘 As a result, Expectation of Jaccard Similarity sim(S,T) is estimated as: E(sim(S,T))=∑ 𝑘𝑘 2𝑚𝑚−𝑘𝑘 𝐶𝐶 𝑚𝑚 𝑘𝑘 𝐶𝐶𝑛𝑛−𝑚𝑚 𝑚𝑚−𝑘𝑘 𝐶𝐶𝑛𝑛 𝑚𝑚 =𝑚𝑚 𝑘𝑘=0 ∑ 𝑘𝑘 2𝑚𝑚−𝑘𝑘 � 𝑚𝑚 𝑘𝑘�� 𝑛𝑛−𝑚𝑚 𝑚𝑚−𝑘𝑘� � 𝑛𝑛 𝑚𝑚� 𝑚𝑚 𝑘𝑘=0 b) How does your answer to part (a) change if R and S must include a certain element (say z) of U? It means k ~> z, then the answer is changed to be: E(sim(S,T))=∑ 𝑧𝑧 2𝑚𝑚−𝑧𝑧 𝐶𝐶 𝑚𝑚 𝑧𝑧 𝐶𝐶𝑛𝑛−𝑚𝑚 𝑚𝑚−𝑧𝑧 𝐶𝐶𝑛𝑛 𝑚𝑚 =𝑧𝑧 𝑘𝑘=0 ∑ 𝑧𝑧 2𝑚𝑚−𝑧𝑧 � 𝑚𝑚 𝑧𝑧 �� 𝑛𝑛−𝑚𝑚 𝑚𝑚−𝑧𝑧� � 𝑛𝑛 𝑚𝑚� 𝑧𝑧 𝑘𝑘=0 c) How does your answer to part (a) change if R and S must be disjoint? It means k=0, then the answer is changed to be: E(sim(S,T))=∑ 𝑘𝑘 2𝑚𝑚−𝑘𝑘 𝐶𝐶 𝑚𝑚 𝑘𝑘 𝐶𝐶𝑛𝑛−𝑚𝑚 𝑚𝑚−𝑘𝑘 𝐶𝐶𝑛𝑛 𝑚𝑚 =0 𝑘𝑘=0 0 6