mirror of
https://github.com/furyfire/trueskill.git
synced 2025-01-16 01:47:39 +00:00
Tiny type work
This commit is contained in:
@ -4,10 +4,15 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DNW\Skills\FactorGraphs;
|
namespace DNW\Skills\FactorGraphs;
|
||||||
|
|
||||||
class FactorGraph
|
abstract class FactorGraph
|
||||||
{
|
{
|
||||||
private VariableFactory $variableFactory;
|
private VariableFactory $variableFactory;
|
||||||
|
|
||||||
|
protected function __construct()
|
||||||
|
{
|
||||||
|
$this->variableFactory = new VariableFactory(fn () => NULL);
|
||||||
|
}
|
||||||
|
|
||||||
public function getVariableFactory(): VariableFactory
|
public function getVariableFactory(): VariableFactory
|
||||||
{
|
{
|
||||||
return $this->variableFactory;
|
return $this->variableFactory;
|
||||||
|
@ -18,6 +18,9 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
|
|||||||
public function buildLayer(): void
|
public function buildLayer(): void
|
||||||
{
|
{
|
||||||
$inputVariablesGroups = $this->getInputVariablesGroups();
|
$inputVariablesGroups = $this->getInputVariablesGroups();
|
||||||
|
/**
|
||||||
|
* @var KeyedVariable[] $currentTeam
|
||||||
|
*/
|
||||||
foreach ($inputVariablesGroups as $currentTeam) {
|
foreach ($inputVariablesGroups as $currentTeam) {
|
||||||
$localCurrentTeam = $currentTeam;
|
$localCurrentTeam = $currentTeam;
|
||||||
$teamPerformance = $this->createOutputVariable($localCurrentTeam);
|
$teamPerformance = $this->createOutputVariable($localCurrentTeam);
|
||||||
|
@ -37,6 +37,7 @@ class TrueSkillFactorGraph extends FactorGraph
|
|||||||
*/
|
*/
|
||||||
public function __construct(private readonly GameInfo $gameInfo, array $teams, array $teamRanks)
|
public function __construct(private readonly GameInfo $gameInfo, array $teams, array $teamRanks)
|
||||||
{
|
{
|
||||||
|
parent::__construct();
|
||||||
$this->priorLayer = new PlayerPriorValuesToSkillsLayer($this, $teams);
|
$this->priorLayer = new PlayerPriorValuesToSkillsLayer($this, $teams);
|
||||||
$newFactory = new VariableFactory(
|
$newFactory = new VariableFactory(
|
||||||
static fn(): GaussianDistribution => GaussianDistribution::fromPrecisionMean(0, 0)
|
static fn(): GaussianDistribution => GaussianDistribution::fromPrecisionMean(0, 0)
|
||||||
|
Reference in New Issue
Block a user