statistics.predictResponse
This function gives the value of a model at `inputs`, on the scale of the measure. The inputs have a value for each dimension that the model reads. An absent conditional dimension has `null`. A table model gives its `fallback` for a combination with no cell.
CLI- Package
- @procedures/statistics · README
- Path
["statistics","predictResponse"]- CLI
mark statistics predictResponse --model <object | object> --inputs <object>- As data
{"$proc":["statistics","predictResponse"],"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","predictResponse"], { model: "<model>", inputs: {} });
console.log(JSON.stringify(result));From the command line
$ mark statistics predictResponse --model <object | object> --inputs <object>
As data, in a program
{
"$proc": ["statistics", "predictResponse"],
"input": { "model": "<model>", "inputs": {} }
}Input
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
model | object | object | yes | ||
inputs | object | yes |
Output
The schema does not list fields (number).
JSON Schemas
{
"input": {
"type": "object",
"properties": {
"model": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "ridge"
},
"lambda": {
"type": "number",
"description": "The penalty of the fit."
},
"inputs": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "level"
},
"levels": {
"type": "array",
"items": {
"type": "string"
}
},
"dimension": {
"type": "string"
},
"conditional": {
"type": "boolean",
"description": "When true, the dimension is conditional, so `null` is a good value. Each term of an absent dimension is 0."
}
},
"required": [
"kind",
"levels",
"dimension"
],
"additionalProperties": {}
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "number"
},
"center": {
"type": "number"
},
"spread": {
"type": "number"
},
"log": {
"type": "boolean"
},
"dimension": {
"type": "string"
},
"conditional": {
"type": "boolean",
"description": "When true, the dimension is conditional, so `null` is a good value. Each term of an absent dimension is 0."
}
},
"required": [
"kind",
"center",
"spread",
"dimension"
],
"additionalProperties": {}
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "rank"
},
"levels": {
"type": "array",
"items": {
"type": "string"
}
},
"center": {
"type": "number"
},
"spread": {
"type": "number"
},
"dimension": {
"type": "string"
},
"conditional": {
"type": "boolean",
"description": "When true, the dimension is conditional, so `null` is a good value. Each term of an absent dimension is 0."
}
},
"required": [
"kind",
"levels",
"center",
"spread",
"dimension"
],
"additionalProperties": {}
}
]
}
},
"intercept": {
"type": "number"
},
"terms": {
"type": "array",
"items": {
"type": "object",
"properties": {
"factors": {
"type": "array",
"items": {
"anyOf": [
{
"type": "object",
"properties": {
"dimension": {
"type": "string"
},
"level": {
"type": [
"string",
"number"
]
}
},
"required": [
"dimension",
"level"
],
"additionalProperties": {}
},
{
"type": "object",
"properties": {
"dimension": {
"type": "string"
},
"power": {
"type": "number"
}
},
"required": [
"dimension",
"power"
],
"additionalProperties": {}
}
]
}
},
"weight": {
"type": "number"
}
},
"required": [
"factors",
"weight"
],
"additionalProperties": {}
}
},
"measure": {
"type": "string",
"description": "The id of the measure of the model."
},
"scale": {
"type": "string",
"enum": [
"linear",
"log"
],
"description": "With `log`, the model and the held-out errors use the base-10 logarithm of the measure."
},
"floor": {
"type": "number",
"description": "With the scale `log`, the fit gave this value to each smaller measured value."
}
},
"required": [
"kind",
"lambda",
"inputs",
"intercept",
"terms",
"measure",
"scale"
],
"additionalProperties": {}
},
{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "table"
},
"dimensions": {
"type": "array",
"items": {
"type": "string"
}
},
"conditional": {
"type": "array",
"items": {
"type": "string"
},
"description": "The ids of the dimensions of the table with a condition. Only these dimensions take `null`."
},
"cells": {
"type": "array",
"items": {
"type": "object",
"properties": {
"at": {
"type": "array",
"items": {
"type": [
"null",
"string",
"number"
]
},
"description": "The value of each dimension of the table, in the order of its `dimensions`. An absent dimension has `null`."
},
"value": {
"type": "number",
"description": "The mean of the measured values of the cell, on the scale of the model."
},
"n": {
"type": "number",
"description": "The number of points of the cell."
}
},
"required": [
"at",
"value",
"n"
],
"additionalProperties": {}
}
},
"fallback": {
"type": "number",
"description": "The value of a combination with no cell: the mean of all the fitted points, on the scale of the model."
},
"measure": {
"type": "string",
"description": "The id of the measure of the model."
},
"scale": {
"type": "string",
"enum": [
"linear",
"log"
],
"description": "With `log`, the model and the held-out errors use the base-10 logarithm of the measure."
},
"floor": {
"type": "number",
"description": "With the scale `log`, the fit gave this value to each smaller measured value."
}
},
"required": [
"kind",
"dimensions",
"cells",
"fallback",
"measure",
"scale"
],
"additionalProperties": {}
}
]
},
"inputs": {
"type": "object",
"properties": {},
"additionalProperties": {
"type": [
"null",
"string",
"number"
]
}
}
},
"required": [
"model",
"inputs"
],
"additionalProperties": false
},
"output": {
"type": "number"
}
}