Download presentation
Presentation is loading. Please wait.
Published byMarianna Mathews Modified over 6 years ago
1
Lecture 18: Uniformity Testing Monotonicity Testing
COMS E F15 Lecture 18: Uniformity Testing Monotonicity Testing Left to the title, a presenter can insert his/her own image pertinent to the presentation.
2
Administrivia, Plan Admin: Plan: Scriber? PS3: pick up
Project proposals: Nov 16th Plan: Uniformity Testing Monotonicity Testing Scriber?
3
Uniformity testing Enough to distinguish:
Algorithm UNIFORM: Input: π, π, π₯ 1 ,β¦ π₯ π πΆ = 0; for(i=0; i<m; i++) for(j=i+1; j<m; j++) if ( π₯ π = π₯ π ) πΆ++; if (πΆ<πβ
π 2 /π) return βUniformβ; else return βNot uniformβ; // π: constant dependent on ο₯ Enough to distinguish: ||π·| | 2 2 =1/π (unif) ||π·| | 2 2 >1/π+ π 2 /π (non-unif) Lemma: 1 π β
πΆ is a good enough as long as π=Ξ© π π 4 where π=π(πβ1)/2 Let π=||π·| | 2 2 Claim 1: πΈ πΆ π =π Claim 2: πππ πΆ π β€ π π + 8 π 2 π π Finish lemma proofβ¦
4
Identity Testing Problem: Classic π 2 test [Pearson 1900]:
We have known distribution π Given samples from π, distinguish between: π=π vs ||πβπ| | 1 β₯π Uniformity is an instance (π= π π ) Classic π 2 test [Pearson 1900]: Let π π = # of occurrences of π π π π βπ π π 2 βπ π π π π β₯πΌ Test of [Valiant, Valiant 2014]: π π π βπ π π 2 β π π π π 2/3 β₯πΌ
5
Distribution Testing++
Other properties? Equality testing: Given samples from unknown π,π, distinguish π=π vs ||πβπ| | 1 β₯π Sample bound: Ξ π ( π 2/3 ) Independence testing: Given samples from (π,π)β π Γ[π], distinguish: π is independent of π vs || π,π βπ΄Γπ΅| | 1 β₯π for any distributions π΄,π΅ on [π] Sample bound: Ξ π (π) Many moreβ¦
6
Testing Monotonicity Problem: given a sequence π₯ 1 ,β¦ π₯ π , distinguish: sequence is sorted, vs sequence is NOT sorted In π(π) time? Hard exactly: can have just one inversion somewhere Approximation notion: π-far All sequences of length π all sorted sequences π-far: if need to delete at least π fraction of elements to make it sorted
7
Testing Monotonicity A testing algorithm: How many samples? Fix?
π-far: if need to delete at least π fraction of elements to make it sorted A testing algorithm: Sample random positions π Check that π₯ π β€ π₯ π iff π<π How many samples? Bad case: 2,1,4,3,β¦,i,i-1,i+2,i+1,β¦,n,n-1 At least Ξ© π before we see an adjacent pair Fix? Can sample adjacent pairs! Works? Bad case too
8
Algorithm: Monotonicity
Assumption: π₯ π β π₯ π One iteration: Pick a random π Do binary search on π₯= π₯ π in the sequence Start with interval [s,t]=[1,n] For interval [s,t], find middle π= π +π‘ 2 If π₯< π₯ π , recurse on the left If π₯> π₯ π , recurse on the right Fail if find inconsistency: 1) π₯ π not found where it should be 2) π₯ π β[ π₯ π , π₯ π‘ ] Algorithm MONOTONICITY: Input: π, π₯ 1 ,β¦ π₯ π for(r=0; π<3/π; r++) Let π₯= π₯ π perform binary search on π₯ if (π₯ not found at position π OR binary search inconsistent) return βnot sortedβ; If finished ok, return βsortedβ.
9
Analysis: Monotonicity
If sorted, will pass the test If π-far from sortedβ¦ How do we argue? Via contrapositive Lemma: suppose one iteration succeeds with probability β₯1βπ Then, sequence β€π far from a sorted sequence Hence, 3/π repetitions are enough to catch the case of >π far from sortedness with probability 90%: Prob to report βsortedβ when itβs far: is at most 1βπ 3/π β€ π β3 β€0.1 Algorithm MONOTONICITY: Input: π, π₯ 1 ,β¦ π₯ π for(r=0; π<3/π; r++) Let π₯= π₯ π perform binary search on π₯ if (π₯ not found at position π OR binary search inconsistent) return βnot sortedβ; If finished ok, return βsortedβ.
10
Analysis: Monotonicity
Lemma: suppose one iteration succeeds with probability β₯1βπ Then, sequence β€π far from a sorted sequence Proof: Call πβ[π] good if it passes the test Claim: if π<π are good, then π₯ π < π₯ π Consider the binary search tree, and their lowest common ancestor π₯ π It must be: π₯ π < π₯ π and π₯ π < π₯ π Hence: good πβs are sorted! βprobability β₯1βπβ β number of good elements is at least 1βπ π End of proof! Algorithm MONOTONICITY: Input: π, π₯ 1 ,β¦ π₯ π for(r=0; π<3/π; r++) Let π₯= π₯ π perform binary search on π₯ if (π₯ not found at position π OR binary search inconsistent) return βnot sortedβ; If finished ok, return βsortedβ.
11
Monotonicity: discussion
Assumption? Replace all π₯ π by ( π₯ π ,π) Then sequence must be strictly monotonic Test is adaptive: Where we query depends on what we learned from the previous queries Do we need adaptivity? No! A each iteration, we query for π₯= π₯ π We know precisely where binary search is supposed to look at! E.g., if π=1, then itβs positions: π 2 , π 4 , π 8 ,β¦ Can generate all the positions to query at the beginning and query them all at the same time Unless, binary search is inconsistent, in which case we detect this from the queries positions Algorithm MONOTONICITY: Input: π, π₯ 1 ,β¦ π₯ π for(r=0; π<3/π; r++) Let π₯= π₯ π perform binary search on π₯ if (π₯ not found at position π OR binary search inconsistent) return βnot sortedβ; If finished ok, return βsortedβ.
12
Monotonicity++ π(log π) queries tight?
Yes Can consider the more general case: Function π: 0,1 π β{0,1} Monotone: if π π₯ β€π(π¦) whenever π₯β€π¦ (coordinate-wise) Can test in π π π queries! [GGLRSβ98, KMSβ15]
13
Testing graphs We have a graph πΊ= π,πΈ Dense case: Sparse case:
π vertices π edges Dense case: π=Ξ π 2 Sparse case: Degree πβ€π(1) Property testing: Eg, is graph πΊ connected? Approximation? π-far: if we need to delete/insert β₯ππ edges
14
Connectivity in sparse graph
Approximation? π-far: if we need to delete/insert β₯ππ edges π=ππ=π(π) When does it make sense? ππβͺ1 (otherwise any sparse graph is close to being connected!) Assume: ππβͺ1 Algorithm: For π=π 1 ππ times repeat: Choose a random node π Run a BSF from π Until see more than 4/ππ node in the CC If the CC is smaller, then report βdisconnectedβ Otherwise, report βconnectedβ
15
Analysis Claim: if π-far, then graph has at most Ξ©(πππ) connected components Proof: Suppose πΊ has π connected component Will connect, using π(π) modifications Idea: Just connect each connected component consecutively Issue: can get higher degree than π in a CC Is really an issue when all nodes in a CC have full degree Just delete one edge (preserving connectivity) Hence, on average a CC has π π πππ =π 1 ππ nodes Will pick one of them with probability at least ππ
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.