/php7-ml-comparison

A kNN algorithm implemented in PHP, Python and Java.

Primary LanguageJava

PHP 7 Machine Learning Comparison

This repository holds the source code for the PHP, Python, JavaScript and Java benchmarks used in the blog post, Is PHP now suitable for machine learning?

Instructions

In the blog post, the benchmarks were run on a single core php7dev Vagrant box. If you'd like to do the same, you'll need to install HHVM, PyPy, NodeJS and the default JDK.

From the location of this readme file, the following commands will run the benchmarks.

# PHP 5.6
newphp 56
php php/iris.php

# PHP 7
newphp 70
php php/iris.php

# Python 2
python python/iris.py

# Python 3
python 3 python/iris.py

# HHVM
hhvm php/iris.php

# PyPy
pypy python/iris.py

# JavaScript
nodejs javascript/iris.js

# Java
cd java
javac Iris.java
java Iris