38
Department of Computer Engineering, Faculty of Engineering, Kasetsart University, THAILAND 1 st Semester 2018 (Aug Dec)

Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Department of Computer Engineering, Faculty of Engineering,Kasetsart University, THAILAND

1st Semester 2018 (Aug – Dec)

Page 2: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Midterm Exam: 40 %

Final Exam: 40 %

Homework: 10 %

Assignment: 10 %

2Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 3: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3

Description Score (0 – 1)

0 – 15 min 1

15.01 – 100 min (100 – MinLate)/100

> 100 min 0

If missing class

• with “letter of leave of absence in advanced”

• without “letter of leave of absence in advanced”

0.5

0

Page 4: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• Your Grade is based on the overall class performance.

• However, the cumulative score below 50% is considered as

fail (F).

• An “F” grade will be given to any form of cheating (for all

parties).

• You are not allowed to take a midterm exam if you miss

more than 2 lectures and also not allowed to take final exam

if you miss more than 4 lectures.

4Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 5: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• All hard-copy assignments must be handed in at the beginning of the class (> 15 min. is considered late).

• For soft-copy will be timed by the local time stamp.

• No Late assignment will be graded.

• No credit for plagiarism and considered as cheating.

• No credit for copying homework or assignment (for all copies) and considered as cheating.

5Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 6: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

⚫ Make-up exam will only be provided only for

restrict circumstances (severe illness)

6Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 7: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Assoc. Prof. Anan Phonphoem, Ph.D.

Department of Computer Engineering, Faculty of Engineering,

Kasetsart University, THAILAND

Page 8: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

What will you think of about Probability?

• Physical PropertyExample: Tossing a dice, a coin, buying lottery

• KnowledgeExample: Earthquake in Thailand, Web page has been

hacked, Trapped in cave

8Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 9: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

⚫ Situation cannot exactly be replicated

⚫ Cooking

⚫ Producing Memory chip, CPU, Harddisk

⚫ But not chaotic

⚫ If perform many experiments, there should be a pattern

⚫ Tossing a coil 100 times

⚫ Probability Value

⚫ [0,1]

9Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 10: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

⚫ Definition⚫ Logic of probability

⚫ Axiom⚫ The truth: no proof needed (3)

⚫ Theorem⚫ Derived from definition and axiom

⚫ Proofed by definition, axiom, and other Theorems

10Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 11: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

⚫ Set: Basic mathematics for probability

⚫ Definition

Set: group of interesting things

Element: members of Set

⚫ Set & Element

a A a is an element of set A (set inclusion)

b B b is not an element of set B

11Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 12: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• T = {Notebook, I-Phone, Wallet, Keys}

• R = {x2+1 | x = 1, 3 , 5, …}

12

Set Name composes of Set member

{on Left side (member of Set) | condition to be members}

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 13: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

13

R = {x2+1 | x = 1, 3, 5, …}

I = {Integer Number}

R I

Set Equality

A = B if and only if (iff) A B and B A

Subset

A B set A is a subset of set B

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 14: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• Bi-conditional logical connective between

statements

• The truth of either one of the connected

statements requires the truth of the other

• i.e., either both statements are true, or both are false

• XNOR gate (opposite of XOR)

• Symbol: ↔ ⇔ ≡

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 14

p q p↔ q

T T T

T F F

F T F

F F T

Definition from: http://en.wikipedia.org/wiki/If_and_only_if

Set Equality A = B if and only if (iff) A B and B A

Page 15: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Universal Set “S”

• Set (all possible members)

• By definition: Every set is subset of S

Null Set “”

• Empty set

• By definition: A

15Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 16: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• John Venn (1834 –1923), was a

British logician, and philosopher.

• Set Relations

16

S S

A

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

http://en.wikipedia.org/

Page 17: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

17

A B

A B

AcAB

AB

AcA

ABA - B

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

A B

C

A B C

Page 18: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

1. Mutually Exclusive

Ai Aj = for i j

For only 2 sets, A B =

called Disjoint

18

A1

A2

A3

A1

A2

Ui = 1

n

Ai = S

2. Collectively Exhaustive

A1 A2 … An = S

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 19: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

19

(A B)c = Ac Bc

Proof: (A B)c Ac Bc and Ac Bc (A B)c

x (A B)c

→x A B

→x A and x B

→x Ac and x Bc

→x Ac Bc

x Ac Bc

→x Ac and x Bc

→x A and x B

→x A B

→x (A B)c

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

P = Q if and only if (iff) P Q and Q P

Page 20: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min
Page 21: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

What is an Experiment?

• Method for finding some facts/conclusions

Give an example?

• For movie “Mission Impossible - Fallout”, is it fun?

21Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

http://time.com/5349500/mission-impossible-fallout/

Page 22: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 22

Film Year Budget

(M$)

Box off.

gross

(M $)

Cimema

Score

Mission: Impossible 1996 80 458 B+

Mission: Impossible 2 2000 125 546 B

Mission: Impossible III 2006 150 398 A-

Mission: Impossible –

Ghost Protocol

2011 145 695 A-

Mission: Impossible –

Rogue Nation

2015 150 687 A-

Mission: Impossible –

Fallout

2018 178 330(1 month)

A

https://upload.wikimedia.org/wikipedia/en/3/3c/Missionimpossible

blurayboxset.jpghttps://en.wikipedia.org/wiki/Mission:_Impossible_(film_series)

Page 23: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

What is an Experiment? • Method for finding some facts/conclusions

Give an example?• For movie “Mission Impossible - Fallout”, is it fun?• Stand in front of the theatre• Ask audiences, fun or not?

Composition of an experiment• Procedure• Observation

Why experiment is needed?• Uncertainty

23Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

https://variety.com/2018/film/reviews/mission-impossible-fallout-review-

1202872043/

Page 24: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• Concern about movie “Mission Impossible - Fallout” experiment

• Should I ask man, women, or teenager?

• Experience of the audiences

• Knowledge of the audiences

• Complicated experiment →need Model

• Real experiments: too complicate

• Capture only the important part

• Model Example:

• Treat all audiences the same

• Answer will only be like/dislike

24

http://www.comic-spass.de/story-en.html

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 25: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Same Procedure but different Observations → Different Experiments

25

Example:

1. Stand in front of the show “Mission Impossible”

and ask 5 people,

Observe the # of people who like the show.

2. Stand in front of the show “Mission Impossible”

and ask 5 people,

Observe the sequence of people who like the show.

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

LDDLL

LLLDL

DLLLD

2

5

1

Page 26: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• Outcome

• Any possible observation

• Sample Space

• Finest-grain: each outcome is different

• Mutually exclusive: if one outcome occurs, other will not occur

• Collectively exhaustive: every outcome must be in the sample

space

• Event

• Set of outcomes (Must know all outcomes )

• Event Sample Space

26Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 27: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Outcomes:number = 0,1,2,3,4,5,6,7,8,9

Sample space:S = {0,1,2,…,9}

Event examples:E1 = {number < 3} = {0,1,2}E2 = {number is odd} = {1,3,5,7,9}

27

For an experiment:

Press a number on the ATM keypad,

observe the number was pressed

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

https://www.123rf.com/

Page 28: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Sample Space• Finest-grain, Mutually exclusive, and Collectively exhaustive

• Members are outcomes

28

Definition: Event Space* Mutually exclusive

* Collectively exhaustive event

• Members are events

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 29: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

29

Theorem:

For an event space B = {B1, B2, …}

and any event A in the S,

Let Ci = A ∩ Bi for i ≠ j,

the events Ci and Cj are mutually exclusive

and A = C1 U C2 U …

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 30: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• Experiment:• Receive 3-bit data

• Examine the data bit in order and observe either data bit is “1” or “0”

• Sample space:• S = {000, 001, 010, 011, 100, 101, 110, 111 }

• Bi = {Outcomes with i Zeros} For i = 0,1,2,3

• B2 = {001, 010, 100}

• Event space B = {B0, B1, B2, B3}

30Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 31: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

• S = {000, 001, 010, 011, 100, 101, 110, 111 }

• Let X = {outcomes < 2 Zeros}

• X = {011, 101, 110, 111 }

• X = (X∩B0)U(X∩B1)U(X∩B2)U(X∩B3)

= B0 U B1 U U

31

Bi X for i = 0 and 1

Event “< 2 Zeros” = “no Zero” U “1 Zero”

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 32: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

32

Set Algebra Probability

Set Event

Universal set Sample space

Element Outcome

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 33: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

33

P[☺]

is a function that maps event

in the sample space to real numberFrom experiment: Press a number on the ATM keypadOutcomes:

number = 0,1,2,3,4,5,6,7,8,9

Sample space:S = {0,1,2,…,9}

Event examples:E1 = {number < 3} = {0,1,2}E2 = {number is odd} = {1,3,5,7,9}

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

https://www.123rf.com/

P[E1] = 3/10

P[E2] = 5/10 = 1/2

Page 34: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Axiom 1: For any event A, P[A] 0

Axiom 2: P[S] = 1

Axiom 3: For events A1, A2,…, An

of mutual exclusive events

P[A1A2…An] = P[A1]+P[A2]+…+P[An]

34Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 35: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Theorem: If A and B are disjoint, then

P[A B] = P[A] + P[B]

Theorem: If B = B1 B2…Bn and

BiBj = for i j, then

35

i = 1

n

P[Bi]P[B] =

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 36: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Theorem: For an experiment with sample space

S={s1,…, sn} if each outcome is equally likely,

P[si] = 1/n 1 i n

36

n repetitions (trials), The number of Event A occurs: NA(n)

limn → ∞ n

NA(n)= P[A]

Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 37: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

Theorem:

• P[] = 0

• P[Ac] = 1 - P[A]

• For any A and B (not necessary disjoint)

P[A B] = P[A] + P[B] – P[AB]

• If A B , then P[A] P[B]

37Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

Page 38: Semester 2018 (Aug Dec) - Kasetsart Universityanan/myhomepage/wp-content/...Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University 3 Description Score (0 –1)0 –15 min

The followings are not easy:

• From practical problem, model the experiment

carefully

• Derive the correct sample space

• Exam & Homework !!!

38Anan Phonphoem, Dept.of Computer Engineering, Kasetsart University

http://mikeiamele.com/make-life-easy/