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;
}
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());
}
Aggregations