← All procedures
statistics.eloUpdate
The Elo update of a pair after one result. The `score` is the score of the first item: 1 for a win, 0.5 for a tie and 0 for a loss. Each rating moves by `k` times the difference between the score and the expected score. Thus the sum of the two ratings does not change.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","eloUpdate"]- CLI
mark statistics eloUpdate --ra <number> --rb <number> --score <number>- As data
{"$proc":["statistics","eloUpdate"],"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","eloUpdate"], { ra: 1, rb: 1, score: 1 });
console.log(JSON.stringify(result));From the command line
$ mark statistics eloUpdate --ra <number> --rb <number> --score <number>
As data, in a program
{
"$proc": ["statistics", "eloUpdate"],
"input": { "ra": 1, "rb": 1, "score": 1 }
}Input
Output
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"ra": {
"type": "number"
},
"rb": {
"type": "number"
},
"score": {
"type": "number"
},
"options": {
"type": "object",
"properties": {
"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": [
"ra",
"rb",
"score"
],
"additionalProperties": false
},
"output": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "The new rating of the first item."
},
"b": {
"type": "number",
"description": "The new rating of the second item."
},
"expected": {
"type": "number",
"description": "The expected score of the first item before the result."
}
},
"required": [
"a",
"b",
"expected"
],
"additionalProperties": {}
}
}