← All procedures

statistics.logLoss

The log-loss of predictions: the mean of `-ln(p)` for a hit and `-ln(1 - p)` for a miss. 0 is perfect, and `ln(2)` is a constant 0.5. Lower is better. A p of 0 for a hit gives Infinity. For an outcome of three values, give the probability of the observed outcome as `p`, with `hit` true.

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

From the command line

$ mark statistics logLoss --forecasts <object[]>

As data, in a program

{ "$proc": ["statistics", "logLoss"], "input": { "forecasts": [] } }

Input

FieldTypeRequiredDefaultDescription
forecastsobject[]yes

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "forecasts": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "p": {
              "type": "number"
            },
            "hit": {
              "type": "boolean"
            }
          },
          "required": [
            "p",
            "hit"
          ],
          "additionalProperties": {}
        }
      }
    },
    "required": [
      "forecasts"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}