Slide 1

Slide 1 text

TREND ANALYSIS AND MACHINE LEARNING IN PHP SYMFONYCON CLUJ 2017 @MICHAELCULLUMUK

Slide 2

Slide 2 text

TREND ANALYSIS AND MACHINE LEARNING IN PHP SYMFONYCON CLUJ 2017 @MICHAELCULLUMUK

Slide 3

Slide 3 text

@MICHAELCULLUMUK ME?

Slide 4

Slide 4 text

MICHAEL CULLUM @MICHAELCULLUMUK

Slide 5

Slide 5 text

@MICHAELCULLUMUK STATISTICS

Slide 6

Slide 6 text

@MICHAELCULLUMUK ARTIFICIAL INTELLIGENCE

Slide 7

Slide 7 text

@MICHAELCULLUMUK MACHINE LEARNING

Slide 8

Slide 8 text

@MICHAELCULLUMUK MACHINE LEARNING

Slide 9

Slide 9 text

@MICHAELCULLUMUK LEARNING Cause
 &
 Effect Context Process Knowledge

Slide 10

Slide 10 text

@MICHAELCULLUMUK USING Cause Knowledge Process Prediction
 of an
 effect

Slide 11

Slide 11 text

@MICHAELCULLUMUK Cause Knowledge Process Process Cause Predicted
 effect Effect

Slide 12

Slide 12 text

@MICHAELCULLUMUK EXAMPLE 1+1= 2 1+2= 3 1+3= 4 2+1= 3 3+1= 4 Cause Effect

Slide 13

Slide 13 text

@MICHAELCULLUMUK EXAMPLE 1+1= 2 1+2= 3 1+3= 4 2+1= 3 3+1= 4 Knowledge

Slide 14

Slide 14 text

@MICHAELCULLUMUK EXAMPLE 1+1= 2 1+2= 3 1+3= 4 2+1= 3 3+1= 4 Cause 3+1= Predicted Effect 4 Knowledge

Slide 15

Slide 15 text

@MICHAELCULLUMUK MACHINE LEARNING AS A 4-STEP PROCESS

Slide 16

Slide 16 text

@MICHAELCULLUMUK 1. ACQUIRE DATA

Slide 17

Slide 17 text

@MICHAELCULLUMUK 2. TRAIN MODEL

Slide 18

Slide 18 text

@MICHAELCULLUMUK 3. ASK YOUR QUESTION

Slide 19

Slide 19 text

@MICHAELCULLUMUK 4. GET PREDICTED ANSWER

Slide 20

Slide 20 text

@MICHAELCULLUMUK 1. ACQUIRE DATA

Slide 21

Slide 21 text

@MICHAELCULLUMUK GOOD LUCK

Slide 22

Slide 22 text

@MICHAELCULLUMUK 2. TRAIN MODEL

Slide 23

Slide 23 text

@MICHAELCULLUMUK SUPERVISED LEARNING UNSUPERVISED LEARNING

Slide 24

Slide 24 text

@MICHAELCULLUMUK SUPERVISED LEARNING

Slide 25

Slide 25 text

@MICHAELCULLUMUK KNOWN OUTCOMES

Slide 26

Slide 26 text

@MICHAELCULLUMUK QUALITATIVE - REGRESSION QUANTATIVE - CLASSIFICATION

Slide 27

Slide 27 text

@MICHAELCULLUMUK QUALITATIVE - REGRESSION QUANTATIVE - CLASSIFICATION

Slide 28

Slide 28 text

@MICHAELCULLUMUK CLASSIFICATION Rating Conclusion 100 Good 25 Bad 50 Good 40 Bad

Slide 29

Slide 29 text

@MICHAELCULLUMUK CLASSIFICATION Rating Conclusion 100 Good 25 Bad 50 Good 40 Bad

Slide 30

Slide 30 text

@MICHAELCULLUMUK LINEAR CLASSIFIER Item Value Black PHP
 Devs White Sales Sales Test PHP Test

Slide 31

Slide 31 text

@MICHAELCULLUMUK QUALITATIVE - REGRESSION QUANTATIVE - CLASSIFICATION

Slide 32

Slide 32 text

@MICHAELCULLUMUK REGRESSION Price % alcohol 5.00 8.25 6.00 10 4.00 6.75 3.00 5 0 2.5 5 7.5 10 0 1.5 3 4.5 6

Slide 33

Slide 33 text

@MICHAELCULLUMUK REGRESSION Price % alcohol 5.00 8.25 6.00 10 4.00 6.75 3.00 5 0 2.5 5 7.5 10 0 1.5 3 4.5 6

Slide 34

Slide 34 text

@MICHAELCULLUMUK UNSUPERVISED LEARNING

Slide 35

Slide 35 text

@MICHAELCULLUMUK DISCOVERY

Slide 36

Slide 36 text

@MICHAELCULLUMUK ASSOCIATION
 CLUSTERING

Slide 37

Slide 37 text

@MICHAELCULLUMUK ASSOCIATION
 CLUSTERING

Slide 38

Slide 38 text

@MICHAELCULLUMUK ASSOCIATION Item 1 Item 2 T-shirt Shorts Shorts T-shirt Suit Black Shoes Socks Underwear Item 1 Item 2 Black shoes Suit Socks Underwear Underwear Socks T-shirt Socks

Slide 39

Slide 39 text

@MICHAELCULLUMUK ASSOCIATION Item 1 Item 2 T-shirt Shorts Shorts T-shirt Suit Black Shoes Socks Underwear Item 1 Item 2 Black shoes Suit Socks Underwear Underwear Socks T-shirt Socks People who buy socks,
 also often buy underwear People who who buy
 underwear always buy
 socks

Slide 40

Slide 40 text

@MICHAELCULLUMUK ASSOCIATION Item 1 Item 2 T-shirt Shorts Shorts T-shirt Suit Black Shoes Socks Underwear Item 1 Item 2 Black shoes Suit Socks Underwear Underwear Socks T-shirt Socks People who buy socks,
 also often buy underwear People who buy suits
 always buy black shoes People who who buy
 underwear always buy
 socks People who buy black
 shoes, always buy suits

Slide 41

Slide 41 text

@MICHAELCULLUMUK ASSOCIATION Item 1 Item 2 T-shirt Shorts Shorts T-shirt Suit Black Shoes Socks Underwear Item 1 Item 2 Black shoes Suit Socks Underwear Underwear Socks T-shirt Socks People who buy socks,
 also often buy underwear People who buy suits
 always buy black shoes People who who buy
 underwear always buy
 socks People who buy black
 shoes, always buy suits People who buy shorts
 always buy t-shirts People who buy t-shirts,
 also often buy shorts

Slide 42

Slide 42 text

@MICHAELCULLUMUK ASSOCIATION
 CLUSTERING

Slide 43

Slide 43 text

@MICHAELCULLUMUK CLUSTER ANALYSIS IS THE TASK OF GROUPING A SET OF OBJECTS IN SUCH A WAY THAT OBJECTS IN THE SAME GROUP ARE MORE SIMILAR TO EACH OTHER THAN TO THOSE IN OTHER GROUPS.

Slide 44

Slide 44 text

@MICHAELCULLUMUK CLUSTER ANALYSIS

Slide 45

Slide 45 text

@MICHAELCULLUMUK 3. QUESTION
 4. PREDICTED ANSWER

Slide 46

Slide 46 text

@MICHAELCULLUMUK ALGORITHMS

Slide 47

Slide 47 text

@MICHAELCULLUMUK LEAST SQUARES

Slide 48

Slide 48 text

@MICHAELCULLUMUK LEAST SQUARES REGRESSION LINE

Slide 49

Slide 49 text

@MICHAELCULLUMUK MATHS

Slide 50

Slide 50 text

@MICHAELCULLUMUK A+BX=Y

Slide 51

Slide 51 text

@MICHAELCULLUMUK ▸ Each point has an x and y value ▸ We need an equation of a line ▸ We move the line an infinite number of times ▸ Each time, we draw a box between every point, and the line, with one corner on the line, and another on the point ▸ The correct line is the one where the sum of the area of all the squares is smallest PROCESS

Slide 52

Slide 52 text

@MICHAELCULLUMUK DEMO

Slide 53

Slide 53 text

@MICHAELCULLUMUK PHP

Slide 54

Slide 54 text

@MICHAELCULLUMUK DEMO

Slide 55

Slide 55 text

@MICHAELCULLUMUK DEMOS php-ai/php-ml

Slide 56

Slide 56 text

@MICHAELCULLUMUK CODE $samples = [[60], [61], [62], [63], [65]]; $targets = [3.1, 3.6, 3.8, 4, 4.1]; $regression = new LeastSquares(); $regression->train($samples, $targets); echo $regression->predict([64]);

Slide 57

Slide 57 text

@MICHAELCULLUMUK NEAREST NEIGHBOUR

Slide 58

Slide 58 text

@MICHAELCULLUMUK NEAREST NEIGHBOUR

Slide 59

Slide 59 text

@MICHAELCULLUMUK 3-NEAREST NEIGHBOUR

Slide 60

Slide 60 text

@MICHAELCULLUMUK 5-NEAREST NEIGHBOUR

Slide 61

Slide 61 text

@MICHAELCULLUMUK MATHS

Slide 62

Slide 62 text

@MICHAELCULLUMUK PHP

Slide 63

Slide 63 text

@MICHAELCULLUMUK DEMO

Slide 64

Slide 64 text

@MICHAELCULLUMUK DEMO 0 1 2 3 4 0 1 2 3 4

Slide 65

Slide 65 text

@MICHAELCULLUMUK DEMO 0 1.25 2.5 3.75 5 0 1 2 3 4

Slide 66

Slide 66 text

@MICHAELCULLUMUK DEMO $samples = [[1, 3], [1, 4], [2, 4], [3, 1], [4, 1], [4, 2]]; $labels = ['a', 'a', 'a', 'b', 'b', 'b']; $classifier = new KNearestNeighbors(); $classifier->train($samples, $labels); echo $classifier->predict([3, 2]);

Slide 67

Slide 67 text

@MICHAELCULLUMUK USES OF MACHINE LEARNING

Slide 68

Slide 68 text

@MICHAELCULLUMUK NUMERICAL ANALYSIS

Slide 69

Slide 69 text

@MICHAELCULLUMUK EXCEPTIONS

Slide 70

Slide 70 text

@MICHAELCULLUMUK E-COMMERCE

Slide 71

Slide 71 text

@MICHAELCULLUMUK FAULT DETECTION

Slide 72

Slide 72 text

@MICHAELCULLUMUK ROOT CAUSE ANALYSIS

Slide 73

Slide 73 text

@MICHAELCULLUMUK CLASSIFICATION

Slide 74

Slide 74 text

@MICHAELCULLUMUK NATURAL LANGUAGE PROCESSING

Slide 75

Slide 75 text

@MICHAELCULLUMUK ANALYSIS OF SUPPORT QUERIES

Slide 76

Slide 76 text

@MICHAELCULLUMUK ANALYSIS OF LARGE NUMBERS OF DOCUMENTS

Slide 77

Slide 77 text

@MICHAELCULLUMUK FUN

Slide 78

Slide 78 text

@MICHAELCULLUMUK ANY QUESTIONS?

Slide 79

Slide 79 text

THANKS @MICHAELCULLUMUK

Slide 80

Slide 80 text

TREND ANALYSIS AND MACHINE LEARNING IN PHP SYMFONYCON CLUJ 2017 @MICHAELCULLUMUK