14b1ae350b
This commit introduces chinese_whispers method without any "helpers" on PHP side. Users needs to take care of everything (building edges from 128D face chip vector, for example), but this is exposed for people that need low-level call and want to calculate distances and build edges in PHP directly.
28 lines
507 B
PHP
28 lines
507 B
PHP
--TEST--
|
|
Basic tests for chinese_whispers
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("pdlib")) print "skip"; ?>
|
|
--FILE--
|
|
<?php
|
|
var_dump(dlib_chinese_whispers([[0,0]])); // Case with only one node
|
|
var_dump(dlib_chinese_whispers([[0,0], [1,1]])); // Case with two separate nodes
|
|
var_dump(dlib_chinese_whispers([[0,0], [0,1], [1,0], [1,1]])); // Case with two connected nodes
|
|
?>
|
|
--EXPECT--
|
|
array(1) {
|
|
[0]=>
|
|
int(0)
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
int(0)
|
|
[1]=>
|
|
int(1)
|
|
}
|
|
array(2) {
|
|
[0]=>
|
|
int(0)
|
|
[1]=>
|
|
int(0)
|
|
}
|