php-ml/docs/machine-learning/metric/distance/manhattan.md

17 lines
303 B
Markdown
Raw Normal View History

# Manhattan
2016-04-15 20:32:20 +00:00
Class for calculation Manhattan distance.
![manhattan](https://upload.wikimedia.org/math/4/c/5/4c568bd1d76a6b15e19cb2ac3ad75350.png "Manhattan Distance")
To calculate distance:
```
$a = [4, 6];
$b = [2, 5];
$manhattan = new Manhattan();
$manhattan->distance($a, $b);
// return 3
```