Code Monkey home page Code Monkey logo

openskill.ex's Introduction

Hex.pm Test Status Coverage Status Hex Downloads Renovate Status

Openskill

Elixir implementation of Weng-Lin Rating, as described at https://www.csie.ntu.edu.tw/~cjlin/papers/online_ranking/online_journal.pdf

Installation

Add openskill to your list of dependencies in mix.exs:

def deps do
  [
    {:openskill, "~> 0.1.0"}
  ]
end

Usage

Ratings are kept as a tuple {mu, sigma} which represent a gaussian curve, where mu represents the mean, and sigma represents the spread or standard deviation. Create these with:

> a1 = Openskill.rating
{25, 8.333333333333334}
> a2 = Openskill.rating(32.444, 5.123)
{32.444, 5.123}
> b1 = Openskill.rating(43.381, 2.421)
{43.381, 2.421}
> b2 = Openskill.rating(25.188, 6.211)
{25.188, 6.211}

If a1 and a2 are on a team, and wins against a team of b1 and b2, send this into rank

> [[a1, a2], [b1, b2]] = Openskill.rate([[a1, a2], [b1, b2]])
[
  [
    {28.669648436582808, 8.071520788025197},
    {33.83086971107981, 5.062772998705765}
  ],
  [
    {43.071274808241974, 2.4166900452721256},
    {23.149503312339064, 6.1378606973362135}
  ]
]

In more simplified matches with one team against another, the losing team's players' mu components should always go down, and up for the winning team's players. sigma components should always go down.

When displaying a rating, or sorting a list of ratings, you can use ordinal

> Openskill.ordinal({43.071274808241974, 2.4166900452721256})
35.821204672425594

By default, this returns mu - 3*sigma, showing a rating for which there's a 99.5% likelihood the player's true rating is higher, so with early games, a player's ordinal rating will usually go up and could go up even if that player loses.

TODO

  • Support shuffled rankings, e.g. Openskill.rank([[p1],[p2],[p3],[p4]], ranks: [1, 4, 2, 3]).
  • Support tied rankings, e.g. Openskill.rank([[p1],[p2],[p3],[p4]], ranks: [1, 2, 2, 4])
  • Configurable alternate gamma to avoid ill-conditioning problems from large numbers of teams, as discussed in the paper.

openskill.ex's People

Contributors

philihp avatar renovate-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

teifion

openskill.ex's Issues

Independency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Using npm packages for Renovate presets is now deprecated. Please migrate to repository-based presets instead.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/elixir.yml
  • actions/setup-elixir v1.5.0
  • actions/checkout v1
  • actions/cache v2
  • actions/cache v2
mix
mix.exs
  • excoveralls ~> 0.13
  • ex_doc >= 0.0.0
  • mix_test_watch ~> 1.0
  • math ~> 0.6.0
  • statistics ~> 0.6.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.