use Widi\NearestNeighbor\Vector;
use Widi\NearestNeighbor\Factory\VectorFactory;
$vectorATwoDimensions = new Vector(11,2);
$vectorBTwoDimensions = new Vector(4,5);
$vectorAThreeDimensions = new Vector(1,5,10);
// this will return true
$vectorATwoDimensions->isCompatible($vectorBTwoDimensions);
// this will return false
$vectorATwoDimensions->isCompatible($vectorThreeDimensions);
// returns 2
$vectorATwoDimensions->getDimensionCount();
// returns 3
$vectorAThreeDimensions->getDimensionCount();
// this should return 7.615773
$vectorATwoDimensions->calculateDistanceTo($vectorBTwoDimensions);
// with factory
$factory = new VectorFactory();
$vector = $factory->create(1,2,3);
// find nearest neighbor
$vectorA = new Vector(0,0);
$vectorB = new Vector(1,1);
$vectorC = new Vector(2,2);
$collection = new VectorCollection(
$vectorA,
$vectorB,
$vectorC
);
// this will return the instance of $vectorA
$collection->findClosest(new Vector(0.1,0.1));
-
Notifications
You must be signed in to change notification settings - Fork 0
Nearest neighbor feature set
License
dirkwinkhaus/Widi-NearestNeighbor
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Nearest neighbor feature set
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published