Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Machine Learning with PHP and PredictionIO

Slide 3

Slide 3 text

I’m bored so give me a TV show to binge watch!

Slide 4

Slide 4 text

Florian Eckerstorfer Developer in Vienna ViennaPHP, 8 September 2014

Slide 5

Slide 5 text

Machine Learning Prediction.io Demo 1 2 3

Slide 6

Slide 6 text

Machine Learning 1

Slide 7

Slide 7 text

Machine learning, a branch of artificial intelligence, concerns the construction and study of systems that can learn from data. wikipedia.org/wiki/Machine_learning

Slide 8

Slide 8 text

Classification

Slide 9

Slide 9 text

Name Creator Network Episode Length Genre The Sopranos David Chase HBO 60 Drama Weeds Jenji Kohan Showtime 30 Comedy Girls Lena Dunham HBO 30 Comedy Orange Is The New Black Jenji Koahn Netflix 30 ?

Slide 10

Slide 10 text

S S S S S S S S S S S S S S S S S S 1. Training

Slide 11

Slide 11 text

2. Generalisation S S S S S S S S S

Slide 12

Slide 12 text

3. Pattern Matching S ? S

Slide 13

Slide 13 text

k-nearest neighbours

Slide 14

Slide 14 text

kNN

Slide 15

Slide 15 text

1 1 2 k=3

Slide 16

Slide 16 text

1 1 2 k=5 2 3

Slide 17

Slide 17 text

k-Nearest Neighbours Decision Trees Support Vector Machines Neural Networks Bayesian Networks

Slide 18

Slide 18 text

Trade Offs Time Memory Accuracy Algorithm vs. Problem

Slide 19

Slide 19 text

PredictionIO 2

Slide 20

Slide 20 text

Machine Learning Server

Slide 21

Slide 21 text

Scala MongoDB Hadoop Apache Mahout

Slide 22

Slide 22 text

PredictionIO Server Admin Web UI Admin Server Engine A Engine B Algorithm X Algorithm Y Algorithm S Algorithm T Workflow Scheduler MapReduce Engine Hadoop Distributed File System Predictive Model Storage Databases REST API Servers SDK SDK Web App Mobile App Ω Ω

Slide 23

Slide 23 text

And now in PHP

Slide 24

Slide 24 text

composer require predictionio/predictionio

Slide 25

Slide 25 text

use PredictionIO\PredictionIOClient; $client = PredictionIOClient::factory(array('appkey'=> '…')); ! // Create a user $command = $client->getCommand( 'create_user', ['pio_uid' => 'florian'] ); $response = $client->execute($command);

Slide 26

Slide 26 text

use PredictionIO\PredictionIOClient; $client = PredictionIOClient::factory(array('appkey'=> '…')); ! // Create an item $command = $client->getCommand( 'create_item', ['pio_iid' => 'Game of Thrones', 'pio_itypes' => 1] ); $response = $client->execute($command);

Slide 27

Slide 27 text

use PredictionIO\PredictionIOClient; $client = PredictionIOClient::factory(array('appkey'=> '…')); ! // User likes an item $client->identify('florian'); $command = $client->getCommand( 'record_action_on_item', ['pio_action' => 'like', 'pio_iid' => 'Game of Thrones'] ); $client->execute($command);

Slide 28

Slide 28 text

use PredictionIO\PredictionIOClient; $client = PredictionIOClient::factory(array('appkey'=> '…')); ! // Top N recommendations for user $client->identify('florian'); $command = $client->getCommand( 'itemrec_get_top_n', ['pio_engine' => 'engine1', 'pio_n' => 10] ); $rec = $client->execute($command); print_r($rec);

Slide 29

Slide 29 text

Demo 3

Slide 30

Slide 30 text

github.com/florianeckerstorfer/viennaphp-predictionio or shrt.at/34O

Slide 31

Slide 31 text

PredictionIO. prediction.io PredictionIO-PHP-SDK. github.com/PredictionIO/ PredictionIO-PHP-SDK PredictionIO on Vagrant. docs.prediction.io/ current/installation/install-predictionio-with- virtualbox-vagrant.html Tom Mitchell. Machine Learning, McGraw Hill, 1997

Slide 32

Slide 32 text

Florian Eckerstorfer [email protected] http://florian.ec @Florian_

Slide 33

Slide 33 text

Questions?