Presentation is loading. Please wait.

Presentation is loading. Please wait.

Machine Learning Overview

Similar presentations


Presentation on theme: "Machine Learning Overview"— Presentation transcript:

1 Machine Learning Overview
Supervised Learning Machine learning is function fitting Does function f exist? Data Observed x1 x xn ... Target y Buy Sell Hold ... Training Testing What y to learn? Machine Learning How to prepare x? How should f look like? How to evaluate f ? Unseen data Patterns y = f(x) Predictions How to find f ?

2 Machine Learning What is the research agenda? How to measure success?
Decision Tree Learning (ID3) Edward Tsang (All rights reserved)

3 Edward Tsang (All rights reserved)
What to learn? We could try to predict the price tomorrow We cold try to predict whether prices will go up (or down) by a margin E.g. will the price go up by r% within n days? Notes: Always ask: can the market be predicted? There is no magic in machine learning Harder task  less chance to succeed Edward Tsang (All rights reserved)

4 All Rights Reserved, Edward Tsang
FTSE 23 April 2017 All Rights Reserved, Edward Tsang

5 All Rights Reserved, Edward Tsang
FTSE 23 April 2017 All Rights Reserved, Edward Tsang

6 Moving Average Rules to Find
Let m-MA be the m-days moving average n-MA be the n-days moving average m < n Possible rules to find: If the m-MA ≤ n-MA, on day d, but m-MA > n-MA on day d+1, then buy If the m-MA ≥ n-MA, on day d, but m-MA < n-MA on day d+1, then sell 23/04/2017 All Rights Reserved, Edward Tsang

7 Edward Tsang (All rights reserved)
Reality Prediction + Confusion Matrix Prediction + 5 2 7 1 3 6 4 10 Reality Edward Tsang (All rights reserved)

8 Performance Measures Ideal Predictions Actual Predictions, Example  +
7 3 10 + 5 2 7 1 3 6 4 10 Reality RC = (5+2) ÷10 = 70% Precision = 2 ÷ 4 = 50% Recall = 2 ÷ 3 = 67% Edward Tsang (All rights reserved)

9 Matthews correlation coefficient (MCC)
CC283 Intelligent Problem Solving 23/04/2017 Matthews correlation coefficient (MCC) Predictions + TN FP O FN TP O+ P P+ n Reality MCC measures the quality of binary classifications Range from -1 to 1 (Related to Chi-square 2) Edward Tsang (All rights reserved) Edward Tsang (all rights reserved)

10 CC283 Intelligent Problem Solving
23/04/2017 Chi-square Test for fit of a distribution Does the distribution agree with expectation? Oi is the number of observations Ei is the expected number n is the number of possible outcomes (n1 degree of freedom) Edward Tsang (All rights reserved) Edward Tsang (all rights reserved)

11 More on Performance Measures
Predictions False Positive Rate = FP/(FP+TN) = 2/(2+5) = 14% True Positive Rate = recall = TP/(TP+FN) = 2/(2+1) = 67% + TN 5 FP 2 7 FN 1 TP 2 3 6 4 10 Reality TN = True Negative FN = False Negative = Miss = Type II Error FP = False Positive = False Alarm = Type I Error TP = True Positive Edward Tsang (All rights reserved)

12 Receiver Operating Characteristic (ROC)
CC283 Intelligent Problem Solving 23/04/2017 Receiver Operating Characteristic (ROC) 1.0 0.0 0.8 0.4 0.2 0.6 Each predication measure occupies one point Points on diagonal represent random predictions A curve can be fitted on multiple measures Note: points may not cover widely Area under the curve measures the classifier’s performance Perfect classification Better (0.14, 0.67) True Positive Rate Random classifications Fawcett, T. (2006). An introduction to ROC analysis. Pattern Recognition Letters, 27, 861–874 1.0 0.0 0.8 0.4 0.2 0.6 False Positive Rate Edward Tsang (All rights reserved) Edward Tsang (all rights reserved)

13 Receiver Operating Characteristic (ROC)
CC283 Intelligent Problem Solving 23/04/2017 Receiver Operating Characteristic (ROC) Liberal classifiers 1.0 0.0 0.8 0.4 0.2 0.6 A classifier may occupy only one area in the ROC space Other classifiers may occupy multiple points Some classifiers may be tuned to occupy different parts of the curve Perfect classification True Positive Rate Random classifications Fawcett, T. (2006). An introduction to ROC analysis. Pattern Recognition Letters, 27, 861–874 Cautious classifiers 1.0 0.0 0.8 0.4 0.2 0.6 False Positive Rate Edward Tsang (All rights reserved) Edward Tsang (all rights reserved)

14 Scarce opportunities 1  +  + Easy to achieve high accuracy
Ideal Predictions Easy Predictions + 9,900 99% 100 1% + 9,900 99% 100 1% 100% 0% Reality Ideal prediction Accuracy = Precision = Recall = 100% Easy score on accuracy Accuracy = 99%, Precision = ? Recall = 0% Easy to achieve high accuracy Worthless predications 23 April 2017 All Rights Reserved, Edward Tsang

15 Scarce opportunities 2 Unintelligent improvement of recall
Easy Predictions Random Predictions + 9,900 99% 100 1% 100% 0% + 9,801 99 99% 1 1% Reality Random move from  to + Accuracy = 98.02% Precision = Recall = 1% Easy score on accuracy Accuracy = 99%, Precision = ? Recall = 0% Unintelligent improvement of recall Random +’ve predictions 23 April 2017 All Rights Reserved, Edward Tsang

16 All Rights Reserved, Edward Tsang
Scarce opportunities 3 Random Predictions Predictions + 9,801 99 99% 1 1% + 9,810 90 99% 10 1% Reality Random move from  to + Accuracy = 98.02% Precision = Recall = 1% Better moves from  to + Accuracy = 98.2% Precision = Recall = 10% A more useful predication Sacrifice accuracy (from 99% in easy prediction) 23 April 2017 All Rights Reserved, Edward Tsang

17 Machine Learning Techniques
Early work: Quinlan’s ID3 / C4.5/ C5 Building decision trees Neural networks A solution is represented by a network Learning through feedbacks Evolutionary computation Keep a population of solutions Learning through survival of the fittest Edward Tsang (All rights reserved)

18 ID3 for machine learning
ID3 is an algorithm invented by Quinlan ID3 performs supervised learning It builds decision trees Perfect fitting with training data Like other machine learning techniques: No guarantee that it fits testing data Danger of “over-fitting” Edward Tsang (All rights reserved)

19 Example Classification Problem: Play Tennis?
Edward Tsang (All rights reserved)

20 Edward Tsang (All rights reserved)
Example Decision Tree Outlook Sunny Overcast Rain Humidity Yes Wind High Normal Strong Weak No Yes No Yes Decision to make: play tennis? Edward Tsang (All rights reserved)

21 Example: ID3 Picks an attribute
CC283 Intelligent Problem Solving 23/04/2017 Example: ID3 Picks an attribute D1-, D2-, D8-, D9+, D11+ D4+, D5+, D6-, D10+, D14- Outlook Yes Sunny Overcast Rain [2+, 3-] [3+, 2-] D3+, D7+, D12+, D13+ [4+, 0-] Pick an attribute A Compute Gain(S, A): Outlook: 0.246 Humidity: 0.151 Wind: 0.048 Temperature: 0.029 Outlook is picked Edward Tsang (All rights reserved) Edward Tsang (all rights reserved)

22 Simplified ID3 in Action (1)
D1-, D2-, D8-, D9+, D11+ D4+, D5+, D6-, D10+, D14- Outlook Yes Sunny Overcast Rain [2+, 3-] [3+, 2-] D3+, D7+, D12+, D13+ [4+, 0-] Not all examples agree on conclusion Pick one attribute “Outlook” is picked Divide examples according to values in Outlook Build each branch recursively “Yes” for “Overcast” Edward Tsang (All rights reserved)

23 Simplified ID3 in Action (2)
Expand Outlook=Sunny Not all examples agree Pick one attribute “Humidity” is picked Divide examples Build two branches “No” for “High” “Yes” for “Normal” D9+, D11+ Outlook = Sunny D1-, D2-, D8-, D9+, D11+ Humidity Yes High Normal D1-, D2-, D8- No Edward Tsang (All rights reserved)

24 Simplified ID3 in Action (3)
Expand Outlook=Rain Not all examples agree Pick one attribute “Wind” is picked Divide examples Build two branches “No” for “Strong” “Yes” for “Weak” D4+, D5+, D10+ Outlook = Rain D4+, D5+, D6-, D10+, D14- Wind Yes Strong Weak D6-, D14- No Edward Tsang (All rights reserved)

25 ID3 in Action – Tree Built
Humidity Wind Outlook Yes No Sunny Overcast Rain Strong Weak High Normal D4+, D5+, D10+ D6-, D14- D9+, D11+ D1-, D2-, D8- D3+, D7+, D12+, D13+ Edward Tsang (All rights reserved)

26 Edward Tsang (All rights reserved)
Remarks on ID3 Decision trees are easy to understand Decision trees are easy to use But what if data has noise? I.e. under the same situation, contradictory results were observed Besides, what if some values are missing from the decision tree? E.g. “Humidity = Low” These are handled by C4.5 and See5 (beyond our syllabus) Edward Tsang (All rights reserved)

27 Exercise Classification Problem - Admit?
CC283 Intelligent Problem Solving Exercise Classification Problem - Admit? 23/04/2017 Student Maths English Physics IT Exam 1 A C B Admit 2 3 4 5 6 7 8 9 10 11 Reject 12 13 14 Suppose the rule is: “Only accept students with at least three (A or B)s, including at least one A”. Could ID3 find it? Suppose the rule is: “Only accept students with at least three (A or B)s, including at least one A”. Could ID3 find it? Edward Tsang (All rights reserved) Edward Tsang (all rights reserved)

28 ID3 Exercise: “admit or reject”
English A B C 3+, 6+, 7+, 9+ Maths 12-, 14- A B C Reject 1+, 2+, 4+ 5+, 8+ 10+, 11-, 13- Admit Admit Will the rule found admit students with (B, B, B, B), or (C, A, A, B)? Admit Edward Tsang (All rights reserved)

29 Lessons from the exercise
Without the right columns in the database, one cannot learn the underlying rule It would help if there were a value “A or B” Rules generalise they may not be correct Some branches may not be covered Not shown in the above slide Edward Tsang (All rights reserved)

30 Machine Learning Summary
Machine learning is function fitting First question: what function to find? Do such functions exist? If not, all efforts are futile How to measure success? Finally, find such functions (ID3, NN, EA) (No more important than the above questions) Caution: avoid too much faith (There is too much hype!) Edward Tsang (All rights reserved)

31 Supplementary Material
CC283 Intelligent Problem Solving 23/04/2017 Supplementary Material Edward Tsang’s note: Slides in this section are copied from my other presentations. Updates should be made in the master copies, not here. Edward Tsang (All rights reserved) Edward Tsang (all rights reserved)

32 Artificial Neural Network
Update weights ….. Compare output with Target Hidden Units Input Units Output Units Sunday, 23 April 2017 Edward Tsang (Copyright)

33 Copyright Edward Tsang
Terminology in GA String with Building blocks with values Chromosome with Genes with alleles 1 evaluation fitness Example of a candidate solution in binary representation (vs real coding) A population is maintained 23 April, 2017 Copyright Edward Tsang CC483 Genetic Algorithms CC483 Genetic Algorithms 33

34 Copyright Edward Tsang
Example Problem For GA maximize f(x) = x – x2 optimal solution: x = 14 (f(x) = 296) Use 5 bits representation e.g. binary = decimal 13 f(x) = 295 Note: representation issue can be tricky Choice of representation is crucial 23 April, 2017 Copyright Edward Tsang

35 Example Initial Population
To maximize f(x) = x – x2 23 April, 2017 Copyright Edward Tsang

36 Selection in Evolutionary Computation
Roulette wheel method The fitter a string, the more chance it has to be selected 24% 10101 28% 01010 19% 11000 29% 01101 23 April, 2017 Copyright Edward Tsang

37 Copyright Edward Tsang
Crossover F(x) 1 1 1 18 13 280 295 1 1 1 1 1 1 1 1 14 296 271 1 1 1 9 Sum of fitness: 1,142 Average fitness: 285.5 23 April, 2017 Copyright Edward Tsang

38 Evolutionary Computation: Model-based Generate & Test
A Model could be a population of solutions, or a probability model Model (To Evolve) Generate: select, create/mutate vectors / trees A Candidate Solution could be a vector of variables, or a tree (To update model) Feedback Candidate Solution Test The Fitness of a solution is application-dependent, e.g. drug testing Observed Performance 23 April, 2017 Copyright Edward Tsang


Download ppt "Machine Learning Overview"

Similar presentations


Ads by Google