Probabilistic Analysis and Randomized Algorithms. Alexandre David B2-206

Hasonló dokumentumok
On The Number Of Slim Semimodular Lattices

Correlation & Linear Regression in SPSS

Dependency preservation

Miskolci Egyetem Gazdaságtudományi Kar Üzleti Információgazdálkodási és Módszertani Intézet Nonparametric Tests

Statistical Inference

Miskolci Egyetem Gazdaságtudományi Kar Üzleti Információgazdálkodási és Módszertani Intézet. Nonparametric Tests. Petra Petrovics.

Correlation & Linear Regression in SPSS

Miskolci Egyetem Gazdaságtudományi Kar Üzleti Információgazdálkodási és Módszertani Intézet. Correlation & Linear. Petra Petrovics.

Miskolci Egyetem Gazdaságtudományi Kar Üzleti Információgazdálkodási és Módszertani Intézet. Hypothesis Testing. Petra Petrovics.

Széchenyi István Egyetem

Mapping Sequencing Reads to a Reference Genome

Construction of a cube given with its centre and a sideline

Statistical Dependence

Bevezetés a kvantum-informatikába és kommunikációba 2015/2016 tavasz

Phenotype. Genotype. It is like any other experiment! What is a bioinformatics experiment? Remember the Goal. Infectious Disease Paradigm

16F628A megszakítás kezelése

Cluster Analysis. Potyó László

Lopocsi Istvánné MINTA DOLGOZATOK FELTÉTELES MONDATOK. (1 st, 2 nd, 3 rd CONDITIONAL) + ANSWER KEY PRESENT PERFECT + ANSWER KEY

Csima Judit április 9.

MATEMATIKA ANGOL NYELVEN

MATEMATIKA ANGOL NYELVEN

Tudományos Ismeretterjesztő Társulat

Tudományos Ismeretterjesztő Társulat

Angol Középfokú Nyelvvizsgázók Bibliája: Nyelvtani összefoglalás, 30 kidolgozott szóbeli tétel, esszé és minta levelek + rendhagyó igék jelentéssel

MATEMATIKA ANGOL NYELVEN

Genome 373: Hidden Markov Models I. Doug Fowler

MATEMATIKA ANGOL NYELVEN MATHEMATICS

Miskolci Egyetem Gazdaságtudományi Kar Üzleti Információgazdálkodási és Módszertani Intézet Factor Analysis

Választási modellek 3

Véges szavak általánosított részszó-bonyolultsága

Create & validate a signature

Performance Modeling of Intelligent Car Parking Systems

Efficient symmetric key private authentication

Local fluctuations of critical Mandelbrot cascades. Konrad Kolesko

Tudok köszönni tegezve és önözve, és el tudok búcsúzni. I can greet people in formal and informal ways. I can also say goodbye to them.

Adatbázisok 1. Rekurzió a Datalogban és SQL-99

2 level 3 innovation tiles. 3 level 2 innovation tiles. 3 level 1 innovation tiles. 2 tribe pawns of each color. 3 height 3 tribe pawns.

ANGOL NYELV KÖZÉPSZINT SZÓBELI VIZSGA I. VIZSGÁZTATÓI PÉLDÁNY

3. MINTAFELADATSOR KÖZÉPSZINT. Az írásbeli vizsga időtartama: 30 perc. III. Hallott szöveg értése

MATEMATIKA ANGOL NYELVEN

A logaritmikus legkisebb négyzetek módszerének karakterizációi

Using the CW-Net in a user defined IP network

Társasjáték az Instant Tanulókártya csomagokhoz

Basic Arrays. Contents. Chris Wild & Steven Zeil. May 28, Description 3

MATEMATIKA ANGOL NYELVEN MATHEMATICS

ANGOL NYELVI SZINTFELMÉRŐ 2013 A CSOPORT. on of for from in by with up to at

ANGOL NYELVI SZINTFELMÉRŐ 2012 A CSOPORT. to into after of about on for in at from

Descriptive Statistics

MATEMATIKA ANGOL NYELVEN

SQL/PSM kurzorok rész

MATEMATIKA ANGOL NYELVEN

Kvantum-informatika és kommunikáció 2015/2016 ősz. A kvantuminformatika jelölésrendszere szeptember 11.

MATEMATIKA ANGOL NYELVEN

Ensemble Kalman Filters Part 1: The basics

MATEMATIKA ANGOL NYELVEN

Erdős-Ko-Rado theorems on the weak Bruhat lattice

MATEMATIKA ANGOL NYELVEN

Computer Architecture

STUDENT LOGBOOK. 1 week general practice course for the 6 th year medical students SEMMELWEIS EGYETEM. Name of the student:

Nemzetközi Kenguru Matematikatábor

Számítógéppel irányított rendszerek elmélete. Gyakorlat - Mintavételezés, DT-LTI rendszermodellek


Alternating Permutations

Előszó.2. Starter exercises. 3. Exercises for kids.. 9. Our comic...17

Please stay here. Peter asked me to stay there. He asked me if I could do it then. Can you do it now?

A modern e-learning lehetőségei a tűzoltók oktatásának fejlesztésében. Dicse Jenő üzletfejlesztési igazgató

MATEMATIKA ANGOL NYELVEN

Dense Matrix Algorithms (Chapter 8) Alexandre David B2-206

Klaszterezés, 2. rész

ANGOL NYELVI SZINTFELMÉRŐ 2014 A CSOPORT

Discussion of The Blessings of Multiple Causes by Wang and Blei

IP/09/473. Brüsszel, március 25

(NGB_TA024_1) MÉRÉSI JEGYZŐKÖNYV

TestLine - Angol teszt Minta feladatsor

2-5 játékos részére, 10 éves kortól

FÖLDRAJZ ANGOL NYELVEN GEOGRAPHY

Supplementary materials to: Whole-mount single molecule FISH method for zebrafish embryo

Tavaszi Sporttábor / Spring Sports Camp május (péntek vasárnap) May 2016 (Friday Sunday)

Funkcionális konnektivitás vizsgálata fmri-adatok alapján

MATEMATIKA ANGOL NYELVEN

USER MANUAL Guest user

AZ ACM NEMZETKÖZI PROGRAMOZÓI VERSENYE

MATEMATIKA ANGOL NYELVEN

LEGYÜNK VÁLASZTÉKOSAK

First experiences with Gd fuel assemblies in. Tamás Parkó, Botond Beliczai AER Symposium

MATEMATIKA ANGOL NYELVEN

EMELT SZINTŰ ÍRÁSBELI VIZSGA

Rezgésdiagnosztika. Diagnosztika

Tudományos Ismeretterjesztő Társulat

There is/are/were/was/will be

MATEMATIKA ANGOL NYELVEN

Supporting Information

discosnp demo - Peterlongo Pierre 1 DISCOSNP++: Live demo

MATEMATIKA ANGOL NYELVEN

Hatékony sztochasztikus mechanizmusok tervezése. Diplomamunka

ANGOL NYELV KÖZÉPSZINT SZÓBELI VIZSGA I. VIZSGÁZTATÓI PÉLDÁNY

Miskolci Egyetem Gazdaságtudományi Kar Üzleti Információgazdálkodási és Módszertani Intézet. Correlation & Regression

Ültetési és öntözési javaslatok. Planting and watering instructions

Bevezetés a kvantum-informatikába és kommunikációba 2014/2015 tavasz

Unit 10: In Context 55. In Context. What's the Exam Task? Mediation Task B 2: Translation of an informal letter from Hungarian to English.

Átírás:

Probabilistic Analysis and Randomized Algorithms Alexandre David B2-206

Today Counting. Basic probability. Appendix C Introduction to randomized algorithms. Chapter 5 27-10-2006 AA1 2

Counting Rule of sum. Number of ways of choosing from one of two sets. A Rule of product. B Number of ways of choosing an ordered pairs from two sets. A B A B A A B B 27-10-2006 AA1 3

Counting Permutations (on ordered sequences): (A,B,C,D) (B,A,C,D) (C,D,A,B) How many possible permutations? Choose 1 st element, choose 2 nd k-permutations: n! Choose k elements among n: Choose 1 st, 2 nd, k th. How many? n!?? ( n k)! 27-10-2006 AA1 4

Counting k-combination k subsets: Set {A,B,C,D,E} (n5), choose 3 among it (k3): {A,B,C}, {A,B,D}, {B,C,D} How many combinations? We count a k-permutation and we keep only one representant for every set of equivalent combination, e.g., {A,B,C}{B,A,C}{C,A,B} n k n! k)! k! 27-10-2006 AA1 5? ( n

Counting Binomial coefficients (n choose k ) n k n n k n k 1 n k 1 1 symmetry recursion useful for Pascal s triangle 27-10-2006 AA1 6

Pascal s Triangle 1 11 1 11 121 1 11 121 1331 1 11 121 1331 14641 27-10-2006 AA1 7

27-10-2006 AA1 8 Binomial Expansion 4 3 2 2 3 4 4 3 2 2 3 3 2 2 2 1 0 4 6 4 ) ( 3 3 ) ( 2 ) ( ) ( 1 ) ( y xy y x y x x y x y xy y x x y x y xy x y x y x y x y x 1 11 121 1331 14641 n k k n k n y x k n y x 0 ) (

Don t panic! Probability Elementary events Sample space S HT HH TH TT Probability defined in terms of a sample space. Elementary events outcomes of an experiment, e.g. head/tail. An event is a subset of S: obtaining one tail and one head {HT,TH}. S certain event. null event. Exclusive eventsdisjoints subsets. Elementary events are exclusive. 27-10-2006 AA1 9

Don t panic! Axioms of Probability Probability distribution Pr{} mapping from events of S to real numbers s.t. S R Pr{A} 0 for any A. Pr{S}1. Pr{A B}Pr{A}Pr{B} for exclusive events. Pr{A} is called the probability of the event A. Pr{ }0 A B Pr{A} Pr{B} Pr{A}1-Pr{A} Pr{A B}Pr{A}Pr{B}- Pr{A B} 27-10-2006 AA1 10

Example Experiment: Toss 2 coins. Elementary events: outcomes. Each elementary event has probability ¼. HT HH TH TT Probability of getting at least one head?? Pr{HT,TH,HH}Pr{HT}Pr{TH}Pr{HH} 3/4. Pr{TT}1-Pr{TT} 27-10-2006 AA1 11

Discrete Probability Distributions A probability distribution is discrete if it is defined over a countable sample space. Pr{ A } Pr{ s} s A Uniform probability distribution if Don t panic! (s elementary event) Pr{ s } 1/ S (Pick an element at random, fair coin ) 27-10-2006 AA1 12

Example Experiment: Flip a fair coin n times. Sample space {H,T} n of size 2 n. Elementary events sequences of length n, of probability 1/2 n. S TTTH HTTH HHTH Pr{A} with? A{exactly k heads and exactly n-k tails} A n k n Pr{ A} / 2 k n 27-10-2006 AA1 13

Conditional Probability We have partial knowledge of the outcome. Flip 2 coins. Tell your friend one is a head. It s not possible that both are tails! Pr{TT} knowing there is one H0. The remaining events are equally equal {HT,TH,HH}. Pr{HH} knowing there is one H1/3. Pr{HH} not knowing there is one H1/4. 27-10-2006 AA1 14

Don t panic! Conditional Probability Probability of A given B (with Pr{B} 0): Pr{ A B} Pr{ A B} Pr{ B} Both A and B occur. Outcome is in B, we normalize. S A B Previous example: Pr{HH there is a H}(1/4)/(3/4). 27-10-2006 AA1 15

Independent Events Events A i are pair-wise independent if Pr{A i A j }Pr{A i }Pr{A j }. Events are mutually independent if Pr I i K A Pr{ A } i i i K for a subset K of indices. If A and B are independent, Pr{A B}Pr{A}. 27-10-2006 AA1 16

Don t panic! Bayes Theorem For two events A and B with non-zero probabilities: Pr{ A B} Pr{ B}Pr{ A B} Pr{ A}Pr{ B A} Pr{ A B} Pr{ A}Pr{ B Pr{ B} A} 27-10-2006 AA1 17

Bayes Theorem Alternative form using B ( B A) ( B A) Pr{ A B} Pr{ A}Pr{ B A} Pr{ A}Pr{ B A} Pr{ A}Pr{ B A} 27-10-2006 AA1 18

Pr{ A B} Pr{ A}Pr{ B Pr{ A}Pr{ B A} A} Pr{ A}Pr{ B A} Example We have a fair coin and a biased coin (always head). Experiment: Choose a coin, flip it twice. Suppose it comes up head twice. What is the probability that it is biased?? AEvent that the biased coin is chosen. BEvent that the coin comes up head twice. Pr{A B}? Pr{A}1/2, Pr{B A}1, Pr{A}1/2, Pr{B A}1/4 (1/ 2) 1 Pr{ A B} (1/ 2) 1 (1/ 2) (1/ 4) 4 / 5 27-10-2006 AA1 19

Discrete Random Variables Probability distribution Pr{} mapping from events of S to real numbers s.t. (axioms) Discrete random variable X function from outcomes of S to real numbers. S R S R 27-10-2006 AA1 20

Don t panic! Discrete Random Variables For a random variable X and a real number x (we choose), the event Xx is defined as {s S : X(s)x}. Pr{ X x} Pr{ s} { s S: X ( s) x} (called the probability density function of X) 27-10-2006 AA1 21

Example Experiment: Roll two 6 sided dices. 36 elementary events in the sample space. Uniform probability distribution: Pr{s}1/36. Xmaximum of the two values on the dice. Pr{X3}?? Corresponding set of elementary events: (1,3), (2,3), (3,3), (3,2), (3,1). Pr{X3}5/36. 27-10-2006 AA1 22

Expected Value Average of the values of a random variable. E[ X ] x Pr{ X x} x E[ X Y ] E[ X ] E[ Y ] 27-10-2006 AA1 23

Example Game: You flip two fair coins. You earn $3 for heads, but lose $2 for tails. Xyour earning. E[X]?? E[X]6*Pr{HH}1*Pr{HT}1*Pr{TH}-4*Pr{TT} 6(1/4)1/41/4-4(1/4)1 27-10-2006 AA1 24

Geometric & Binomial Distributions Appendix C.4. Interesting read. 27-10-2006 AA1 25

Probabilistic Analysis and Randomized Algorithms What is it about? Worst case analysis worst cost or running time of an algorithm. Probabilistic average in terms of cost or running time. Randomized algorithms algorithms that have a randomized decision but the result is not random! 27-10-2006 AA1 26

Hiring Problem Example Hire new office assistant and fire the old (worse) one. Cost of interviewing and hiring O(nc i mc h ). Idea: Cheap to interview, expensive to hire. Result is independent of the ordering. best0 for i 1 to n do interview candidate i if candidate i is better than candidate best then besti hire candidate i 27-10-2006 AA1 27

Hiring Problem Example Worst case hire everyone (focus on hiring): O(nc h ). More interesting: probabilistic analysis. Saying that applicants arrive in a random order is the same as choosing randomly any possible permutation of applicants (n! permutations). Expected cost of hiring? How do we do? 27-10-2006 AA1 28

Indicator Variables I{A}1 if A occurs, I{A}0 if it does not. Example: Expected number of heads if we flip one fair coin. S{H,T} XI{YH} E[X]1*Pr{YH}0*Pr{YT}1/2. Lemma: Given an event A in S, let X A I{A}. Then E{X A }Pr{A}. 27-10-2006 AA1 29

Hiring Problem cont. X i I{hire candidate i}. XNumber of hired candidatesx 1 X 2 X n. E[X]E[X 1 ]E[X 2 ] E[X n ] E[X i ]Pr{hire candidate i}1/i. E[X]sum(1/i) harmonic serie, see A.7 E[X]lnnO(1). Expected cost O(c h lnn) 27-10-2006 AA1 30

Randomized Algorithms What we did: Knowing the distribution (uniform) of an input, we analyzed an algorithm. When we don t know, we can impose a distribution beforehand we can analyze such a randomized algorithm for any input. The point: Even your worst enemy cannot produce a bad input since the execution time depends on the (randomized) algorithm. Every run is different. The end result is the same. 27-10-2006 AA1 31

Permuting Arrays A way to randomize inputs Permute by sorting Assign random priorities and sort Θ(n lgn). nlength[a] for i 1 to n do P[i]Random(1,n 3 ) sort A using P as keys It is a uniform random permutation, i.e., every output has probability 1/n!. 27-10-2006 AA1 32

Permuting Arrays Randomize in-place. Swap elements randomly. nlength[a] for i 1 to n do swap(a[i],a[random(i,n)]) It is also a uniform random permutation. Proof technique: Based on a loop invariant. Initialization. Maintenance. Termination. 27-10-2006 AA1 33