statistics.modeCount
This function counts the modes of a sample. A mode counts when it holds `minShare` of the mass. The default counts the modes that hold 10 percent, and a caller who needs all modes passes a smaller value. The result is at least 1. The result is the same for `x` and `-x`.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","modeCount"]- CLI
mark statistics modeCount --values <number[]>- As data
{"$proc":["statistics","modeCount"],"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","modeCount"], { values: [] });
console.log(JSON.stringify(result));From the command line
$ mark statistics modeCount --values <number[]>
As data, in a program
{ "$proc": ["statistics", "modeCount"], "input": { "values": [] } }Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
values | number[] | yes | ||
options | object | no |
Output
The schema does not list fields (number).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"values": {
"type": "array",
"items": {
"type": "number"
}
},
"options": {
"type": "object",
"properties": {
"minShare": {
"type": "number",
"description": "The smallest share of the mass that makes a mode. The default is `0.1`. Half of the mass of the largest mode also makes a mode, so many equal modes each count."
},
"valleyRatio": {
"type": "number",
"description": "The valley between two peaks of the kernel is under this share of the lower peak. The default is `0.5`."
}
},
"additionalProperties": {}
}
},
"required": [
"values"
],
"additionalProperties": false
},
"output": {
"type": "number"
}
}