use of jskills.Rating in project ACManager by kun368.
the class RatingServiceTest method generateRating.
@Test
public void generateRating() throws Exception {
Contest contest = trainingService.getContest(135);
List<Contest> contestList = new ArrayList<>();
contestList.add(contest);
List<RatingRecord> list = ratingService.generateRating(contestList, RatingRecord.Scope.Global, 1, RatingRecord.Type.Personal, 1.0);
System.out.println(list);
Collections.sort(list, (o1, o2) -> {
Rating rating1 = new Rating(o1.getMean(), o1.getStandardDeviation());
Rating rating2 = new Rating(o2.getMean(), o2.getStandardDeviation());
return Double.compare(rating2.getConservativeRating(), rating1.getConservativeRating());
});
for (RatingRecord record : list) {
Rating rating = new Rating(record.getMean(), record.getStandardDeviation());
System.out.println(record.getIdentifier() + ": " + rating.getMean() + "\t " + rating.getStandardDeviation() + "\t " + rating.getConservativeRating());
}
}
use of jskills.Rating in project ACManager by kun368.
the class PlayerPriorValuesToSkillsLayer method buildLayer.
@Override
public void buildLayer() {
for (ITeam currentTeam : teams) {
List<KeyedVariable<IPlayer, GaussianDistribution>> currentTeamSkills = new ArrayList<>();
for (Entry<IPlayer, Rating> currentTeamPlayer : currentTeam.entrySet()) {
KeyedVariable<IPlayer, GaussianDistribution> playerSkill = createSkillOutputVariable(currentTeamPlayer.getKey());
AddLayerFactor(createPriorFactor(currentTeamPlayer.getKey(), currentTeamPlayer.getValue(), playerSkill));
currentTeamSkills.add(playerSkill);
}
addOutputVariableGroup(currentTeamSkills);
}
}
use of jskills.Rating 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.Rating in project VoxelGamesLibv2 by VoxelGamesLib.
the class EloHandler method handleGameEnd.
/**
* Handles the elo calculation for generic games
*
* @param game the game that ended
* @param users the users which played this game, in order, first = winner
*/
public void handleGameEnd(@Nonnull Game game, @Nonnull User... users) {
List<ITeam> teams = new ArrayList<>();
for (User user : users) {
teams.add(new jskills.Team(user, user.getRating(game.getGameMode())));
}
Map<IPlayer, Rating> newRatings = calculator.calculateNewRatings(game.getGameMode(), teams, IntStream.of(users.length).toArray());
update(game, newRatings);
}
Aggregations