Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

($10) Some calculations produce NaN #9

Closed
micheljung opened this issue Apr 16, 2018 · 3 comments
Closed

($10) Some calculations produce NaN #9

micheljung opened this issue Apr 16, 2018 · 3 comments

Comments

@micheljung
Copy link

micheljung commented Apr 16, 2018

Bountysource

This works fine:

  @Test
  public void testOk() {
    GameInfo gameInfo = new GameInfo(1500, 500, 240, 10, 0.1);
    Collection<ITeam> ts = Arrays.asList(
      new Team().addPlayer(new jskills.Player<>(1), new Rating(3453, 74)),
      new Team().addPlayer(new jskills.Player<>(2), new Rating(38, 181))
    );
    Map<IPlayer, Rating> newRatings = TrueSkillCalculator.calculateNewRatings(gameInfo, new ArrayList<>(ts), 1, 2);

    newRatings.forEach((iPlayer, rating) -> System.out.println(rating));
  }

Output:

Mean(μ)=3453.000000, Std-Dev(σ)=74.672619
Mean(μ)=38.000000, Std-Dev(σ)=181.276033

While this produces NaN (note that only player 2's deviation has been changed)

  @Test
  public void testNaN() {
    GameInfo gameInfo = new GameInfo(1500, 500, 240, 10, 0.1);
    Collection<ITeam> ts = Arrays.asList(
      new Team().addPlayer(new jskills.Player<>(1), new Rating(3453, 74)),
      new Team().addPlayer(new jskills.Player<>(2), new Rating(38, 180))
    );
    Map<IPlayer, Rating> newRatings = TrueSkillCalculator.calculateNewRatings(gameInfo, new ArrayList<>(ts), 1, 2);

    newRatings.forEach((iPlayer, rating) -> System.out.println(rating));
  }

Output:

Mean(μ)=NaN, Std-Dev(σ)=74.672619
Mean(μ)=38.000000, Std-Dev(σ)=180.277564
@micheljung micheljung changed the title Some calculations produce NaN ($10) Some calculations produce NaN Apr 16, 2018
@micheljung
Copy link
Author

Same Bug in Skills (moserware#12)

@pmg1991
Copy link

pmg1991 commented May 3, 2018

@micheljung Please review the code.

@nsp
Copy link
Owner

nsp commented May 15, 2018

LGTM

@nsp nsp closed this as completed May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants