Cleanup in src/, adding namespaces, removing php closing tag and general code cleanup

This commit is contained in:
Alexander Liljengård
2016-05-24 14:10:39 +02:00
parent 9f97eb1653
commit 5694a2fb30
64 changed files with 891 additions and 1328 deletions

View File

@ -1,14 +1,8 @@
<?php
namespace Moserware\Skills\TrueSkill\Factors;
<?php namespace Moserware\Skills\TrueSkill\Factors;
require_once(dirname(__FILE__) . "/../../FactorGraphs/Message.php");
require_once(dirname(__FILE__) . "/../../FactorGraphs/Variable.php");
require_once(dirname(__FILE__) . "/../../Numerics/GaussianDistribution.php");
require_once(dirname(__FILE__) . "/GaussianFactor.php");
use Moserware\Numerics\GaussianDistribution;
use Moserware\Skills\FactorGraphs\Message;
use Moserware\Skills\FactorGraphs\Variable;
use Moserware\Skills\Numerics\GaussianDistribution;
/**
* Supplies the factor graph with prior information.
@ -24,7 +18,7 @@ class GaussianPriorFactor extends GaussianFactor
parent::__construct(sprintf("Prior value going to %s", $variable));
$this->_newMessage = new GaussianDistribution($mean, sqrt($variance));
$newMessage = new Message(GaussianDistribution::fromPrecisionMean(0, 0),
sprintf("message from %s to %s", $this, $variable));
sprintf("message from %s to %s", $this, $variable));
$this->createVariableToMessageBindingWithMessage($variable, $newMessage);
}
@ -43,6 +37,4 @@ class GaussianPriorFactor extends GaussianFactor
$message->setValue($newMessage);
return GaussianDistribution::subtract($oldMarginal, $newMarginal);
}
}
?>
}