progress
This commit is contained in:
parent
6f11ff674d
commit
b74c906a12
3 changed files with 399 additions and 0 deletions
39
tests/model_test.php
Normal file
39
tests/model_test.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
|
||||
require 'ncc';
|
||||
|
||||
import('net.nosial.alizelib');
|
||||
|
||||
$model = new \AlizeLib\GeneralizationModel(100);
|
||||
|
||||
function random_float ($min,$max)
|
||||
{
|
||||
return ($min+lcg_value()*(abs($max-$min)));
|
||||
}
|
||||
|
||||
// Add random high float values to the model under label "en" x 150 times
|
||||
for($i = 0; $i < 150; $i++)
|
||||
{
|
||||
$model->add("en", random_float(0.5, 1));
|
||||
}
|
||||
|
||||
// Add random low float values to the model under label "zh" x 150 times
|
||||
for($i = 0; $i < 150; $i++)
|
||||
{
|
||||
$model->add("zh", random_float(0, 0.5));
|
||||
}
|
||||
|
||||
// Add random very low float values to the model under label "fr" x 150 times
|
||||
for($i = 0; $i < 150; $i++)
|
||||
{
|
||||
$model->add("fr", random_float(0, 0.1));
|
||||
}
|
||||
|
||||
// Add random very high float values to the model under label "de" x 150 times
|
||||
for($i = 0; $i < 150; $i++)
|
||||
{
|
||||
$model->add("de", random_float(0.9, 1));
|
||||
}
|
||||
|
||||
var_dump($model->calculateBestLabels());
|
Loading…
Add table
Add a link
Reference in a new issue