← All procedures

statistics.heldOutError

This function gives the held-out error of a measure over all the folds. Each point has the same weight, so a small fold has a small effect. The function throws a RangeError when no fold has the measure.

CLI
Package
@procedures/statistics · README
Path
["statistics","heldOutError"]
CLI
mark statistics heldOutError --record <object> --measure <string>
As data
{"$proc":["statistics","heldOutError"],"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","heldOutError"], { record: {}, measure: "<measure>" });
console.log(JSON.stringify(result));

From the command line

$ mark statistics heldOutError --record <object> --measure <string>

As data, in a program

{
  "$proc": ["statistics", "heldOutError"],
  "input": { "record": {}, "measure": "<measure>" }
}

Input

FieldTypeRequiredDefaultDescription
recordobjectyes
measurestringyes

Output

FieldTypeRequiredDefaultDescription
nnumberyesThe number of held-out points.
foldsnumberyesThe number of folds with this measure.
maenumberyesThe mean absolute error of all the held-out points.
rmsenumberyesThe root mean square error of all the held-out points.
baselineMaenumberyesThe mean absolute error of the baseline.
skillnull | numberyesThe value `1 - mae / baselineMae`. The value 0 is no better than the mean. A baseline of 0 gives `null`.
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "record": {
        "type": "object",
        "properties": {
          "folds": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "heldOut": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The ids of the held-out points."
                },
                "errors": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {
                    "type": "object",
                    "properties": {
                      "n": {
                        "type": "number",
                        "description": "The number of held-out points with a value of the measure."
                      },
                      "mae": {
                        "type": "number",
                        "description": "The mean absolute error."
                      },
                      "rmse": {
                        "type": "number",
                        "description": "The root mean square error."
                      },
                      "baselineMae": {
                        "type": "number",
                        "description": "The mean absolute error of the mean of the training points, used as the prediction."
                      }
                    },
                    "required": [
                      "n",
                      "mae",
                      "rmse",
                      "baselineMae"
                    ],
                    "additionalProperties": {}
                  },
                  "description": "The error of each measure. A measure with no held-out point or no training point has no entry."
                },
                "predictions": {
                  "type": "object",
                  "properties": {},
                  "additionalProperties": {
                    "type": "object",
                    "properties": {},
                    "additionalProperties": {
                      "type": "number"
                    }
                  },
                  "description": "The prediction of each held-out point with a value, on the scale of the model. The keys are the id of the measure, then the id of the point. The model of this fold gave them. Only the option `outOfFold` of `fitResponse` writes this field."
                }
              },
              "required": [
                "heldOut",
                "errors"
              ],
              "additionalProperties": {}
            }
          }
        },
        "required": [
          "folds"
        ],
        "additionalProperties": {}
      },
      "measure": {
        "type": "string"
      }
    },
    "required": [
      "record",
      "measure"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "object",
    "properties": {
      "n": {
        "type": "number",
        "description": "The number of held-out points."
      },
      "folds": {
        "type": "number",
        "description": "The number of folds with this measure."
      },
      "mae": {
        "type": "number",
        "description": "The mean absolute error of all the held-out points."
      },
      "rmse": {
        "type": "number",
        "description": "The root mean square error of all the held-out points."
      },
      "baselineMae": {
        "type": "number",
        "description": "The mean absolute error of the baseline."
      },
      "skill": {
        "description": "The value `1 - mae / baselineMae`. The value 0 is no better than the mean. A baseline of 0 gives `null`.",
        "type": [
          "null",
          "number"
        ]
      }
    },
    "required": [
      "n",
      "folds",
      "mae",
      "rmse",
      "baselineMae",
      "skill"
    ],
    "additionalProperties": {}
  }
}