← All procedures

statistics.eloReplay

The Elo ratings of `items` items after each pick of `comparisons`, in the order of the list. Each item starts at `start`. The update of each pick is `eloUpdate` with the options. The order of the picks changes the result.

CLI
Package
@procedures/statistics · README
Path
["statistics","eloReplay"]
CLI
mark statistics eloReplay --items <number> --comparisons <object[]>
As data
{"$proc":["statistics","eloReplay"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/statistics/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["statistics","eloReplay"], { items: 1, comparisons: [] });
console.log(JSON.stringify(result));

From the command line

$ mark statistics eloReplay --items <number> --comparisons <object[]>

As data, in a program

{
  "$proc": ["statistics", "eloReplay"],
  "input": { "items": 1, "comparisons": [] }
}

Input

FieldTypeRequiredDefaultDescription
itemsnumberyes
comparisonsobject[]yes
optionsobjectno

Output

The schema does not list fields (number[]).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "items": {
        "type": "number"
      },
      "comparisons": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "a": {
              "type": "number"
            },
            "b": {
              "type": "number"
            },
            "outcome": {
              "type": "string",
              "enum": [
                "a",
                "b",
                "tie"
              ]
            },
            "weight": {
              "type": "number",
              "description": "The weight of the comparison. The default is 1. A weight of 2 counts as two equal comparisons."
            }
          },
          "required": [
            "a",
            "b",
            "outcome"
          ],
          "additionalProperties": {}
        }
      },
      "options": {
        "type": "object",
        "properties": {
          "start": {
            "type": "number",
            "description": "The rating of each item before its first pick. The default is 1500."
          },
          "k": {
            "type": "number",
            "description": "The largest change of a rating after one result (the K factor). The default is 32."
          },
          "center": {
            "type": "number",
            "description": "The rating of the log-strength 0. The default is 1500. Elo uses only differences, so it does not read it."
          },
          "scale": {
            "type": "number",
            "description": "The number of points that gives odds of `base` to 1. The default is 400."
          },
          "base": {
            "type": "number",
            "description": "The base of the odds. The default is 10."
          }
        },
        "additionalProperties": {}
      }
    },
    "required": [
      "items",
      "comparisons"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "array",
    "items": {
      "type": "number"
    }
  }
}