Machine Learning with PHP

image source: commons.wikimedia.org

About me

Kruno Knego

Croatia

Backend developer @tech.kartenmacherei 

PHP (Symfony2, Codeigniter, CakePHP)

DevOps (Vagrant, Docker)

Disclaimer

image source: commons.wikimedia.org

Table of contents

  • Machine learning basics
  • Algorithms (Classification, Clustering, Regression)
  • Application of classification algorithm with PHP
  • Is it worth using PHP for ML?
  • Q&A

Machine Learning basics

image source: maxpixel.freegreatpicture.com

Statistics

Data mining

Machine Learning

a branch of mathematics dealing with the collection, analysis, interpretation, and presentation of masses of numerical data

Machine learning is the subfield of computer science that gives computers the ability to learn without being explicitly programmed.

Data mining is the computational process of discovering patterns in large data sets

What is vector?

image source: commons.wikimedia.org

  • magnitude
  • direction
  • addition
  • substraction
  • Data Instances
    • ML data consists of them
    • represented as feature vectors
  • Feature Vectors
    • height, weight, hair color, eye color

(160,50)

(195,95)

(186,86)

(190,90)

(170,60)

(175,65)

(180,80)

(186,86,brown,brown, ...)

height

weight

Machine Learning is not an "exact science"

0

1

0.1

0.9

0.95

0.05

0.97

0.01

0.99

0.91

  • 0 not spam
  • 1 spam

Classification

Clustering

Regression

  • We're trying to fit a line through the data points
  • Ranking ( #1, #2, ... )
  • We are given data that we know is belonging to particular group (english, german, ... )
  • supervised learnining
  • english and japanese (latin alphabet and kanji)
  • unsupervised learning

Classification Algorithms

k-nearest neighbor

image source: en.wikipedia.org

support vector machine

image source: en.wikipedia.org

decision tree

height > 180?

weight > 80?

male

female

weight > 70?

female

male

handwriting recognition

0 1 2 3 4 5 6 7 8 9

0 1 2 3 4 5 6 7 8 9

2

3

What is Pocket?

How to improve Pocket?

Solution

php-ml

  • github.com/php-ai/php-ml
  • github.com/php-ai/php-ml/examples
  • PHP >= 7.0
  • helpful documentation

Show me the CODE!

image source: goldberg.berkeley.edu

Should I use PHP for Machine Learning?

Q & A

image source: en.wikipedia.org

Machine Learning with PHP

By Kruno Knego

Machine Learning with PHP

  • 691
Loading comments...

More from Kruno Knego