statistics.choosePair
The choice of the next pair of a duel from a pool of rated items. The pool goes in the order of the ratings, from the highest. These are the steps:
CLI- Package
- @procedures/statistics · README
- Path
["statistics","choosePair"]- CLI
mark statistics choosePair --items <object[]> --options <object>- As data
{"$proc":["statistics","choosePair"],"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","choosePair"], { items: [], options: {} });
console.log(JSON.stringify(result));From the command line
$ mark statistics choosePair --items <object[]> --options <object>
As data, in a program
{
"$proc": ["statistics", "choosePair"],
"input": { "items": [], "options": {} }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
items | object[] | yes | ||
options | object | yes |
Output
The schema does not list fields (object | null).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The key of the item. Each key occurs one time in a pool. A second item with the same key does not count."
},
"rating": {
"type": "number",
"description": "The rating, on the Elo scale of the options."
},
"se": {
"type": "number",
"description": "The standard error of the rating, in rating points, or `undefined` when the model gives none."
},
"picks": {
"type": "number",
"description": "The number of picks of the item."
}
},
"required": [
"id",
"rating",
"picks"
],
"additionalProperties": {}
}
},
"options": {
"type": "object",
"properties": {
"seed": {
"description": "The seed of the draws.",
"type": [
"string",
"number"
]
},
"recent": {
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "string"
},
{
"type": "string"
}
],
"additionalItems": {},
"minItems": 2,
"maxItems": 2
},
"description": "The pairs of the last duels, by key, in each order. The choice takes a recent pair only when there is no other pair."
},
"candidates": {
"type": "number",
"description": "The number of second items to examine for the first item. It is a whole number of 1 or more. The default is 24."
},
"information": {
"type": "object",
"properties": {
"$proc": {
"minItems": 1,
"type": "array",
"items": {
"type": "string"
}
},
"input": {},
"$when": {
"type": "string",
"const": "$never"
}
},
"required": [
"$proc"
],
"additionalProperties": {},
"x-procedures-program": {
"params": [
"a",
"b"
],
"inputs": [
{
"$ref": "#/$defs/RatedItem"
},
{
"$ref": "#/$defs/RatedItem"
}
],
"output": {
"type": "number"
},
"undefinedForNull": true
},
"description": "This function gives the information of a pick between two items, or `undefined` when the pair is not permitted. The value is a finite number. The default is `pairInformation` with the default scale, and it permits each pair."
}
},
"required": [
"seed"
],
"additionalProperties": {}
}
},
"required": [
"items",
"options"
],
"additionalProperties": false
},
"output": {
"anyOf": [
{
"type": "object",
"properties": {
"a": {
"type": "string"
},
"b": {
"type": "string"
},
"information": {
"type": "number",
"description": "The information of the pair."
}
},
"required": [
"a",
"b",
"information"
],
"additionalProperties": {}
},
{
"type": "null"
}
]
}
}