Search in sources :

Example 11 with GaussianDistribution

use of jskills.numerics.GaussianDistribution in project ACManager by kun368.

the class TrueSkillFactorGraph method getUpdatedRatings.

public Map<IPlayer, Rating> getUpdatedRatings() {
    Map<IPlayer, Rating> result = new HashMap<>();
    for (List<KeyedVariable<IPlayer, GaussianDistribution>> currentTeam : priorLayer.getOutputVariablesGroups()) {
        for (KeyedVariable<IPlayer, GaussianDistribution> currentPlayer : currentTeam) {
            final Rating rating = new Rating(currentPlayer.getValue().getMean(), currentPlayer.getValue().getStandardDeviation());
            result.put(currentPlayer.getKey(), rating);
        }
    }
    return result;
}
Also used : IPlayer(jskills.IPlayer) GaussianDistribution(jskills.numerics.GaussianDistribution) Rating(jskills.Rating)

Example 12 with GaussianDistribution

use of jskills.numerics.GaussianDistribution in project ACManager by kun368.

the class Rating method partialUpdate.

// ----------------------------
public static Rating partialUpdate(Rating prior, Rating fullPosterior, double updatePercentage) {
    GaussianDistribution priorGaussian = new GaussianDistribution(prior), posteriorGaussian = new GaussianDistribution(fullPosterior);
    // From a clarification email from Ralf Herbrich:
    // "the idea is to compute a linear interpolation between the prior and
    // posterior skills of each player ... in the canonical space of
    // parameters"
    double precisionDifference = posteriorGaussian.getPrecision() - priorGaussian.getPrecision();
    double partialPrecisionDifference = updatePercentage * precisionDifference;
    double precisionMeanDifference = posteriorGaussian.getPrecisionMean() - priorGaussian.getPrecisionMean();
    double partialPrecisionMeanDifference = updatePercentage * precisionMeanDifference;
    GaussianDistribution partialPosteriorGaussion = GaussianDistribution.fromPrecisionMean(priorGaussian.getPrecisionMean() + partialPrecisionMeanDifference, priorGaussian.getPrecision() + partialPrecisionDifference);
    return new Rating(partialPosteriorGaussion.getMean(), partialPosteriorGaussion.getStandardDeviation(), prior.getConservativeStandardDeviationMultiplier());
}
Also used : GaussianDistribution(jskills.numerics.GaussianDistribution)

Aggregations

GaussianDistribution (jskills.numerics.GaussianDistribution)12 IPlayer (jskills.IPlayer)2 Rating (jskills.Rating)2 ArrayList (java.util.ArrayList)1 ITeam (jskills.ITeam)1 GaussianFactor (jskills.trueskill.factors.GaussianFactor)1 GaussianGreaterThanFactor (jskills.trueskill.factors.GaussianGreaterThanFactor)1 GaussianWithinFactor (jskills.trueskill.factors.GaussianWithinFactor)1