Skip to content
HALOWERK

Denkwerk

eval sample

Strata are the combinations of the values of stratify_by fields and, optionally, of a text clustering (TF-IDF over Unicode words without Snowball stop words, smooth idf ln((1+N)/(1+df))+1, L2-normalised; farthest-first initialisation (Gonzalez 1985) seeded by the SHA-256 key, then spherical k-means (Dhillon & Modha 2001) for at most 30 iterations). Allocation: proportional (largest remainder method on n*N_h/N) or equal (n/H, capped at the stratum size, surplus moved to strata with spare.

POST https://denk.halowerk.com/v1/eval-sample

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
recordsarrayYesLog records (objects).
sizeintegerYesSample size n.
id_fieldstringNo
stratify_byarrayNo
clusterobjectNo
allocationstringNo
min_per_stratumintegerNo
seedstringNo
dedupe_fieldstringNoDrop records whose text in this field (trimmed, lower case, whitespace collapsed) repeats an earlier record.
return_recordsbooleanNo
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "records",
    "size"
  ],
  "properties": {
    "records": {
      "type": "array",
      "minItems": 1,
      "maxItems": 20000,
      "items": {
        "type": "object",
        "maxProperties": 64
      },
      "description": "Log records (objects)."
    },
    "size": {
      "type": "integer",
      "minimum": 1,
      "maximum": 5000,
      "description": "Sample size n."
    },
    "id_field": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "default": "id"
    },
    "stratify_by": {
      "type": "array",
      "maxItems": 4,
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 64
      }
    },
    "cluster": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "text_field",
        "k"
      ],
      "properties": {
        "text_field": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64
        },
        "k": {
          "type": "integer",
          "minimum": 2,
          "maximum": 50
        }
      }
    },
    "allocation": {
      "type": "string",
      "enum": [
        "proportional",
        "equal"
      ],
      "default": "proportional"
    },
    "min_per_stratum": {
      "type": "integer",
      "minimum": 0,
      "maximum": 100,
      "default": 1
    },
    "seed": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "default": "0"
    },
    "dedupe_field": {
      "type": "string",
      "minLength": 1,
      "maxLength": 64,
      "description": "Drop records whose text in this field (trimmed, lower case, whitespace collapsed) repeats an earlier record."
    },
    "return_records": {
      "type": "boolean",
      "default": false
    }
  }
}

Open original schema

Published input example

{
  "size": 2,
  "stratify_by": [
    "model"
  ],
  "records": [
    {
      "id": "a",
      "model": "x"
    },
    {
      "id": "b",
      "model": "x"
    },
    {
      "id": "c",
      "model": "y"
    },
    {
      "id": "d",
      "model": "y"
    }
  ]
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub โ†’