diff --git a/src/FactorGraphs/ScheduleLoop.php b/src/FactorGraphs/ScheduleLoop.php index 7087324..ea5cf86 100644 --- a/src/FactorGraphs/ScheduleLoop.php +++ b/src/FactorGraphs/ScheduleLoop.php @@ -10,6 +10,7 @@ class ScheduleLoop extends Schedule { } + #[\Override] public function visit(int $depth = -1, int $maxDepth = 0): float { $delta = $this->scheduleToLoop->visit($depth + 1, $maxDepth); diff --git a/src/FactorGraphs/ScheduleSequence.php b/src/FactorGraphs/ScheduleSequence.php index 98a33d1..8c0df14 100644 --- a/src/FactorGraphs/ScheduleSequence.php +++ b/src/FactorGraphs/ScheduleSequence.php @@ -13,6 +13,7 @@ class ScheduleSequence extends Schedule { } + #[\Override] public function visit(int $depth = -1, int $maxDepth = 0): float { $maxDelta = 0; diff --git a/src/FactorGraphs/ScheduleStep.php b/src/FactorGraphs/ScheduleStep.php index e4e31b9..7f18c1d 100644 --- a/src/FactorGraphs/ScheduleStep.php +++ b/src/FactorGraphs/ScheduleStep.php @@ -10,6 +10,7 @@ class ScheduleStep extends Schedule { } + #[\Override] public function visit(int $depth = -1, int $maxDepth = 0): float { return $this->factor->updateMessageIndex($this->index); diff --git a/src/Player.php b/src/Player.php index d0aa075..9816f69 100644 --- a/src/Player.php +++ b/src/Player.php @@ -47,6 +47,7 @@ class Player implements ISupportPartialPlay, ISupportPartialUpdate /** * Indicates the percent of the time the player should be weighted where 0.0 indicates the player didn't play and 1.0 indicates the player played 100% of the time. */ + #[\Override] public function getPartialPlayPercentage(): float { return $this->PartialPlayPct; @@ -55,6 +56,7 @@ class Player implements ISupportPartialPlay, ISupportPartialUpdate /** * Indicated how much of a skill update a player should receive where 0.0 represents no update and 1.0 represents 100% of the update. */ + #[\Override] public function getPartialUpdatePercentage(): float { return $this->PartialUpdatePct; diff --git a/src/TrueSkill/FactorGraphTrueSkillCalculator.php b/src/TrueSkill/FactorGraphTrueSkillCalculator.php index 9fa4af9..779f833 100644 --- a/src/TrueSkill/FactorGraphTrueSkillCalculator.php +++ b/src/TrueSkill/FactorGraphTrueSkillCalculator.php @@ -32,6 +32,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator /** * {@inheritdoc} */ + #[\Override] public function calculateNewRatings( GameInfo $gameInfo, array $teams, @@ -54,6 +55,7 @@ class FactorGraphTrueSkillCalculator extends SkillCalculator /** * {@inheritdoc} */ + #[\Override] public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float { // We need to create the A matrix which is the player team assigments. diff --git a/src/TrueSkill/Factors/GaussianFactor.php b/src/TrueSkill/Factors/GaussianFactor.php index dbd86e4..924703f 100644 --- a/src/TrueSkill/Factors/GaussianFactor.php +++ b/src/TrueSkill/Factors/GaussianFactor.php @@ -14,6 +14,7 @@ abstract class GaussianFactor extends Factor /** * Sends the factor-graph message with and returns the log-normalization constant. */ + #[\Override] protected function sendMessageVariable(Message $message, Variable $variable): float|int { $marginal = $variable->getValue(); @@ -24,6 +25,7 @@ abstract class GaussianFactor extends Factor return $logZ; } + #[\Override] public function createVariableToMessageBinding(Variable $variable): Message { $newDistribution = GaussianDistribution::fromPrecisionMean(0, 0); diff --git a/src/TrueSkill/Factors/GaussianGreaterThanFactor.php b/src/TrueSkill/Factors/GaussianGreaterThanFactor.php index 85c2979..6ec1ca7 100644 --- a/src/TrueSkill/Factors/GaussianGreaterThanFactor.php +++ b/src/TrueSkill/Factors/GaussianGreaterThanFactor.php @@ -22,6 +22,7 @@ class GaussianGreaterThanFactor extends GaussianFactor $this->createVariableToMessageBinding($variable); } + #[\Override] public function getLogNormalization(): float { $vars = $this->getVariables(); @@ -42,6 +43,7 @@ class GaussianGreaterThanFactor extends GaussianFactor ); } + #[\Override] protected function updateMessageVariable(Message $message, Variable $variable): float { $oldMarginal = clone $variable->getValue(); diff --git a/src/TrueSkill/Factors/GaussianLikelihoodFactor.php b/src/TrueSkill/Factors/GaussianLikelihoodFactor.php index badf36b..eb08e54 100644 --- a/src/TrueSkill/Factors/GaussianLikelihoodFactor.php +++ b/src/TrueSkill/Factors/GaussianLikelihoodFactor.php @@ -28,6 +28,7 @@ class GaussianLikelihoodFactor extends GaussianFactor $this->createVariableToMessageBinding($variable2); } + #[\Override] public function getLogNormalization(): float { /** @@ -73,6 +74,7 @@ class GaussianLikelihoodFactor extends GaussianFactor return GaussianDistribution::subtract($newMarginal, $marginal1); } + #[\Override] public function updateMessageIndex(int $messageIndex): float { $messages = $this->getMessages(); diff --git a/src/TrueSkill/Factors/GaussianPriorFactor.php b/src/TrueSkill/Factors/GaussianPriorFactor.php index 0644ff1..d88ef54 100644 --- a/src/TrueSkill/Factors/GaussianPriorFactor.php +++ b/src/TrueSkill/Factors/GaussianPriorFactor.php @@ -29,6 +29,7 @@ class GaussianPriorFactor extends GaussianFactor $this->createVariableToMessageBindingWithMessage($variable, $newMessage); } + #[\Override] protected function updateMessageVariable(Message $message, Variable $variable): float { $oldMarginal = clone $variable->getValue(); diff --git a/src/TrueSkill/Factors/GaussianWeightedSumFactor.php b/src/TrueSkill/Factors/GaussianWeightedSumFactor.php index 27ff3e9..4125ce4 100644 --- a/src/TrueSkill/Factors/GaussianWeightedSumFactor.php +++ b/src/TrueSkill/Factors/GaussianWeightedSumFactor.php @@ -127,6 +127,7 @@ class GaussianWeightedSumFactor extends GaussianFactor } } + #[\Override] public function getLogNormalization(): float { $vars = $this->getVariables(); @@ -197,6 +198,7 @@ class GaussianWeightedSumFactor extends GaussianFactor return $finalDiff; } + #[\Override] public function updateMessageIndex(int $messageIndex): float { $allMessages = $this->getMessages(); diff --git a/src/TrueSkill/Factors/GaussianWithinFactor.php b/src/TrueSkill/Factors/GaussianWithinFactor.php index 3ce8316..7142965 100644 --- a/src/TrueSkill/Factors/GaussianWithinFactor.php +++ b/src/TrueSkill/Factors/GaussianWithinFactor.php @@ -23,6 +23,7 @@ class GaussianWithinFactor extends GaussianFactor $this->createVariableToMessageBinding($variable); } + #[\Override] public function getLogNormalization(): float { /** @@ -46,6 +47,7 @@ class GaussianWithinFactor extends GaussianFactor return -GaussianDistribution::logProductNormalization($messageFromVariable, $message) + log($z); } + #[\Override] protected function updateMessageVariable(Message $message, Variable $variable): float { $oldMarginal = clone $variable->getValue(); diff --git a/src/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php b/src/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php index fd3cdfa..36333f2 100644 --- a/src/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php +++ b/src/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php @@ -22,6 +22,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer parent::__construct($parentGraph); } + #[\Override] public function getLocalFactors(): array { return array_merge( @@ -30,6 +31,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer ); } + #[\Override] public function buildLayer(): void { $inputVariablesGroups = $this->getInputVariablesGroups(); @@ -41,6 +43,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer $this->teamDifferencesComparisonLayer->buildLayer(); } + #[\Override] public function createPriorSchedule(): ?ScheduleSequence { switch (count($this->getInputVariablesGroups())) { diff --git a/src/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php b/src/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php index 7ddfc7b..318ed24 100644 --- a/src/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php +++ b/src/TrueSkill/Layers/PlayerPerformancesToTeamPerformancesLayer.php @@ -13,6 +13,7 @@ use DNW\Skills\FactorGraphs\KeyedVariable; class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLayer { + #[\Override] public function buildLayer(): void { $inputVariablesGroups = $this->getInputVariablesGroups(); @@ -32,6 +33,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye } } + #[\Override] public function createPriorSchedule(): ?ScheduleSequence { $localFactors = $this->getLocalFactors(); @@ -66,6 +68,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye ); } + #[\Override] public function createPosteriorSchedule(): ?ScheduleSequence { $allFactors = []; diff --git a/src/TrueSkill/Layers/PlayerPriorValuesToSkillsLayer.php b/src/TrueSkill/Layers/PlayerPriorValuesToSkillsLayer.php index 8dffc06..762dc92 100644 --- a/src/TrueSkill/Layers/PlayerPriorValuesToSkillsLayer.php +++ b/src/TrueSkill/Layers/PlayerPriorValuesToSkillsLayer.php @@ -27,6 +27,7 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer parent::__construct($parentGraph); } + #[\Override] public function buildLayer(): void { $teams = $this->teams; @@ -49,6 +50,7 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer } } + #[\Override] public function createPriorSchedule(): ?ScheduleSequence { $localFactors = $this->getLocalFactors(); diff --git a/src/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php b/src/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php index f60a81b..cf92a0f 100644 --- a/src/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php +++ b/src/TrueSkill/Layers/PlayerSkillsToPerformancesLayer.php @@ -13,6 +13,7 @@ use DNW\Skills\FactorGraphs\ScheduleSequence; class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer { + #[\Override] public function buildLayer(): void { $inputVarGroups = $this->getInputVariablesGroups(); @@ -51,6 +52,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key); } + #[\Override] public function createPriorSchedule(): ?ScheduleSequence { $localFactors = $this->getLocalFactors(); @@ -65,6 +67,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer ); } + #[\Override] public function createPosteriorSchedule(): ?ScheduleSequence { $localFactors = $this->getLocalFactors(); diff --git a/src/TrueSkill/Layers/TeamDifferencesComparisonLayer.php b/src/TrueSkill/Layers/TeamDifferencesComparisonLayer.php index 53fa675..163cf1a 100644 --- a/src/TrueSkill/Layers/TeamDifferencesComparisonLayer.php +++ b/src/TrueSkill/Layers/TeamDifferencesComparisonLayer.php @@ -23,6 +23,7 @@ class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer $this->epsilon = DrawMargin::getDrawMarginFromDrawProbability($gameInfo->getDrawProbability(), $gameInfo->getBeta()); } + #[\Override] public function buildLayer(): void { $inputVarGroups = $this->getInputVariablesGroups(); diff --git a/src/TrueSkill/Layers/TeamPerformancesToTeamPerformanceDifferencesLayer.php b/src/TrueSkill/Layers/TeamPerformancesToTeamPerformanceDifferencesLayer.php index 5199d20..ba47505 100644 --- a/src/TrueSkill/Layers/TeamPerformancesToTeamPerformanceDifferencesLayer.php +++ b/src/TrueSkill/Layers/TeamPerformancesToTeamPerformanceDifferencesLayer.php @@ -9,6 +9,7 @@ use DNW\Skills\TrueSkill\Factors\GaussianWeightedSumFactor; class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillFactorGraphLayer { + #[\Override] public function buildLayer(): void { $inputVariablesGroups = $this->getInputVariablesGroups(); diff --git a/src/TrueSkill/TwoPlayerTrueSkillCalculator.php b/src/TrueSkill/TwoPlayerTrueSkillCalculator.php index 30414b7..f4e7819 100644 --- a/src/TrueSkill/TwoPlayerTrueSkillCalculator.php +++ b/src/TrueSkill/TwoPlayerTrueSkillCalculator.php @@ -31,6 +31,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator /** * {@inheritdoc} */ + #[\Override] public function calculateNewRatings( GameInfo $gameInfo, array $teams, @@ -138,6 +139,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator /** * {@inheritdoc} */ + #[\Override] public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float { $this->validateTeamCountAndPlayersCountPerTeam($teams); diff --git a/src/TrueSkill/TwoTeamTrueSkillCalculator.php b/src/TrueSkill/TwoTeamTrueSkillCalculator.php index 8bdc1b5..6c5d89c 100644 --- a/src/TrueSkill/TwoTeamTrueSkillCalculator.php +++ b/src/TrueSkill/TwoTeamTrueSkillCalculator.php @@ -31,6 +31,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator /** * {@inheritdoc} */ + #[\Override] public function calculateNewRatings(GameInfo $gameInfo, array $teams, array $teamRanks): RatingContainer { $this->validateTeamCountAndPlayersCountPerTeam($teams); @@ -146,6 +147,7 @@ class TwoTeamTrueSkillCalculator extends SkillCalculator /** * {@inheritdoc} */ + #[\Override] public function calculateMatchQuality(GameInfo $gameInfo, array $teams): float { $this->validateTeamCountAndPlayersCountPerTeam($teams);