Skip to content

Euclidean Distance Method + Manhatan Distance Method + Minkowski Distance Method + Chebychef Distance Method + Canbera Distance Method + Bray Curtis Distance Method + Kullback Leibler Distance Method + Jensen Shannon Distance Method

Notifications You must be signed in to change notification settings

MiqdadM/multidistance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multidistance

Build Status Total Downloads Latest Unstable Version

Calculate 2 Vektor Using 8 Distance Based Similarity Method :

  • Euclidean Distance Method
  • Manhatan Distance Method
  • Minkowski Distance Method
  • Chebychef Distance Method
  • Canbera Distance Method
  • Bray Curtis Distance Method
  • Kullback Leibler Distance Method
  • Jensen Shannon Distance Method

Requirements

PHP 5.4 +

Installation

Run via composer

composer require miqdadm/multidistance

Or, you can put into your composer.json file.

"require": {
  "miqdadm/multidistance": "*"
}

Then run composer update

composer update

Basic Usage

<?php

require 'vendor/autoload.php';
use MiqdadM\Multidistance\multidistance as Calculate;

$test = new Calculate([4, 3, 6], [2, 3, 7]);
$test->distance(); //do this method first

echo 'Euclidean Distance Method';
echo'<pre>';
print_r($test->getEuclidean()); // 2.2360679774998
echo'</pre>';

echo '</br>';
echo 'Manhatan (City Block) Distance Method';
echo'<pre>';
print_r($test->getManhatan()); // 3
echo'</pre>';

echo '</br>';
echo 'Minkowski Distance (&#955 = 3) Method';
echo'<pre>';
print_r($test->getMinkowski()); // 1.9129311827724
echo'</pre>';

echo '</br>';
echo 'Chebychef Distance Method';
echo'<pre>';
print_r($test->getChebychef()); // 2
echo'</pre>';

echo '</br>';
echo 'Canbera Distance Method';
echo'<pre>';
print_r($test->getCanbera()); // 0.41025641025641
echo'</pre>';

echo '</br>';
echo 'Bray Curtis Distance Method';
echo'<pre>';
print_r($test->getBrayCurtis()); // 0.12
echo'</pre>';

echo '</br>';
echo 'Kullback Leibler Distance Method';
echo'<pre>';
print_r($test->getKullbackLeibler()); // 1.8476846432762
echo'</pre>';

echo '</br>';
echo 'Jensen Shannon Distance Method';
echo'<pre>';
print_r($test->getJensenShannon()); // 0.37829763262563
echo'</pre>';

About

Euclidean Distance Method + Manhatan Distance Method + Minkowski Distance Method + Chebychef Distance Method + Canbera Distance Method + Bray Curtis Distance Method + Kullback Leibler Distance Method + Jensen Shannon Distance Method

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages