mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-18 20:04:28 +00:00
More return types. Basic example
This commit is contained in:
@ -13,7 +13,7 @@ use DNW\Skills\Numerics\GaussianDistribution;
|
||||
*/
|
||||
class GaussianPriorFactor extends GaussianFactor
|
||||
{
|
||||
private $newMessage;
|
||||
private GaussianDistribution $newMessage;
|
||||
|
||||
public function __construct(float $mean, float $variance, Variable $variable)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ use DNW\Skills\Numerics\GaussianDistribution;
|
||||
/**
|
||||
* Factor that sums together multiple Gaussians.
|
||||
*
|
||||
* See the accompanying math paper for more details.s
|
||||
* See the accompanying math paper for more details.
|
||||
*/
|
||||
class GaussianWeightedSumFactor extends GaussianFactor
|
||||
{
|
||||
@ -213,7 +213,7 @@ class GaussianWeightedSumFactor extends GaussianFactor
|
||||
);
|
||||
}
|
||||
|
||||
private static function createName($sumVariable, $variablesToSum, $weights)
|
||||
private static function createName(string $sumVariable, array $variablesToSum, array $weights): string
|
||||
{
|
||||
// TODO: Perf? Use PHP equivalent of StringBuilder? implode on arrays?
|
||||
$result = (string) $sumVariable;
|
||||
|
@ -10,7 +10,7 @@ use DNW\Skills\FactorGraphs\ScheduleSequence;
|
||||
|
||||
class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
|
||||
{
|
||||
public function buildLayer()
|
||||
public function buildLayer(): void
|
||||
{
|
||||
$inputVariablesGroups = $this->getInputVariablesGroups();
|
||||
$outputVariablesGroups = &$this->getOutputVariablesGroups();
|
||||
|
@ -9,7 +9,7 @@ use DNW\Skills\TrueSkill\TrueSkillFactorGraph;
|
||||
|
||||
class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer
|
||||
{
|
||||
private $epsilon;
|
||||
private float $epsilon;
|
||||
|
||||
public function __construct(TrueSkillFactorGraph $parentGraph, private readonly array $teamRanks)
|
||||
{
|
||||
@ -18,7 +18,7 @@ class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer
|
||||
$this->epsilon = DrawMargin::getDrawMarginFromDrawProbability($gameInfo->getDrawProbability(), $gameInfo->getBeta());
|
||||
}
|
||||
|
||||
public function buildLayer()
|
||||
public function buildLayer(): void
|
||||
{
|
||||
$inputVarGroups = $this->getInputVariablesGroups();
|
||||
$inputVarGroupsCount = is_countable($inputVarGroups) ? count($inputVarGroups) : 0;
|
||||
|
@ -78,7 +78,7 @@ class TwoPlayerTrueSkillCalculator extends SkillCalculator
|
||||
return $results;
|
||||
}
|
||||
|
||||
private static function calculateNewRating(GameInfo $gameInfo, Rating $selfRating, Rating $opponentRating, $comparison)
|
||||
private static function calculateNewRating(GameInfo $gameInfo, Rating $selfRating, Rating $opponentRating, $comparison): Rating
|
||||
{
|
||||
$drawMargin = DrawMargin::getDrawMarginFromDrawProbability(
|
||||
$gameInfo->getDrawProbability(),
|
||||
|
Reference in New Issue
Block a user