{
  "chapter": "ML-22",
  "globalAPI": "Ml22Math",
  "methods": [
    "split",
    "fit",
    "evaluate",
    "select",
    "paired",
    "realdata"
  ],
  "numericContract": {
    "externalTokenCharacters": 256,
    "externalExponentAbsoluteMax": 200,
    "externalNumericCharacters": 500000,
    "callerJSONCharacters": 3000000,
    "internalRationalDigits": 100000,
    "defaultWork": 20000000,
    "defaultRealdataWork": 200000000,
    "maxWork": 200000000,
    "maxRows": 20000,
    "maxFeatures": 16,
    "IDs": "Nonempty trimmed printableASCII <=120characters, unique rowIDs; no number/string coercion.",
    "externalOnly": "Externalnumericcharacter budget applies to suppliedcaller numeric tokens. Preserved embeddedsource canonical fractions use a separately validated internalreader with pertoken256/work/internaldigitguards, never budget-driven rows/model reduction.",
    "packets": "ExactFraction+numerator+denominator, correct binary64display and exactzero/nonzero-underflow/finiteoverflow/roundedone flags. Undefined is separately packed and never zero/false.",
    "sourceWorkRationale": "Measured complete Wine6497x12/fivecandidate comparison needs161716916 counted exact-work units after algebraically identical reuse. Native default is explicit200m, within the already-declared200m finite maximum; caller input/token/JSON/internal-digit limits unchanged. Work0/insufficient budgets still reject; no sample/model reduction. Long source requests require Worker/Cancel/late-response/cache controls."
  },
  "inputContracts": {
    "split": {
      "rows": [
        "id?",
        "group?"
      ],
      "seed": "integer0..2^32−1 default20261104",
      "pattern": "1..16roles from train/validation/test default[test,validation,train,train]",
      "law": "Sortedgroups then LCG32FisherYates; samegroup one role before eligibility; deterministic schedule,not uniformrandomsampling claim."
    },
    "fit": {
      "rows": [
        "id?",
        "x",
        "y(nullable)",
        "weight?",
        "role?",
        "group?",
        "cohort?"
      ],
      "task": "regression(default)/binary; binaryy exactly0/1 ornull",
      "features": "p inferredfirstrow or explicitly0..16, common vector length",
      "method": "constant/ridge(default)/stump",
      "lambda": "nonnegative exact default1/100; parsedfor allmethods,penalty applies onlyridge",
      "minLeafRows": "integer1..20000 default1; applies onlystump",
      "frame": "Allmethods use same positive completeX/Y trainingframe, includingconstant. Means/ranges training only. Queries need completeX but canlackY. Binarypredictions clipped[0,1],rawvaluesretained; clipping notcalibration.",
      "rank": "RidgeRREF freecoordinates0; queryinvariance packedboolean distinct from fitdefinition. Constant1parameter. Stump usestrainingweightedSSE,midpointthreshold,minLeafrowcount,strictgain; noimprovement yieldsconstant.",
      "noTraining": "Undefinedmodel/predictions,allinputrowsretained."
    },
    "evaluate": {
      "rows": [
        "id?",
        "y(nullable)",
        "prediction(nullable)",
        "weight?",
        "role?",
        "group?",
        "cohort?"
      ],
      "task": "regression/binary",
      "role": "test(default)/all/train/validation/excluded/unused",
      "threshold": "probability default1/2, inclusivepositive classification; usesexactprobability notroundeddisplay",
      "cohorts": "OptionaluniqueASCIIcohort list,max128; missingcohort riskundefined",
      "scope": "Allsuppliednumericfields validatedeveninactive/zero-weight. MSE/MAE exact;R2 undefinedconstantoutcome. BinaryBrier onecomponent,weightedconfusionmasses+separaterowcounts,AUROC halfcredit ties and missingclassundefined. Perroweligible andselectedRoleEligible distinct;correct ispacked definedboolean."
    },
    "select": {
      "rows": [
        "id?",
        "y(nullable)",
        "weight?",
        "role?",
        "cohort?"
      ],
      "candidates": "1..16uniqueID+parallelnullablepredictionarray",
      "metric": "MSE(default)/MAE",
      "criterion": "mean(default)/worst-cohort",
      "requiredCohorts": "OptionaluniqueASCII list,defaultallobservedcohorts",
      "frame": "Common complete label/allcandidateprediction positiveactiveframe; onlyvalidation selects;strict tiesdeclarationorder;testreportonly. Missingrequiredcohort validationriskundefined."
    },
    "paired": {
      "rows": [
        "id?",
        "y(nullable)",
        "predictionA(nullable)",
        "predictionB(nullable)",
        "weight?",
        "role?",
        "group?"
      ],
      "task": "regression/binary",
      "metric": "MSE(default)/MAE",
      "role": "test(default)/all/train/validation/excluded/unused",
      "scope": "Same-rowlossA−lossB,group totalsand deleteonegroup renormalizedweights. AllinputrowsretainedpureAPI. Atleast2positivepairedgroups neededforLOOrange/jackknifevarianceproxy. ConventionalproxyisnotautomaticCI/p-value;fits/selectionfixed andsamplingconditionsseparate."
    },
    "realdata": {
      "kind": "country(default)/person/company; country meansPortugalwineindustrycontext,observationunitwine",
      "seed": "integer0..2^32−1 default20261104",
      "criterion": "mean(default)/worst-cohort",
      "candidates": [
        "constant",
        "ridge:1/100",
        "ridge:1/10",
        "ridge:1",
        "one-split-stump withminLeafRows5"
      ],
      "scope": "Allsource rows/nativefields preserved. Commoncomplete trainframe and samegroup-preservingsplit for5candidates. ValidationMSE selects;testneverselects. Returnallcandidate diagnostics/parameters+complete selected/baseline rowpredictions; pairedsensitivity includes allplannedtestrows includingexcludedmissinglabels. Omit redundantunselectedrowdumps,not observations or calculations."
    }
  },
  "nativeGroups": "Source-only group serialization: reduce each native numeric token to its Fraction string (integer denominator omitted; missing=None/empty/dot becomes JSON null); form an ordered compact JSON array with separators comma/colon and no spaces/newline, UTF-8 SHA256 lowercase hex. Wine array is [red indicator1/white0, eleven chemistry predictors in native header order]; Churn array is thirteen native predictors in native header order, omitting Churn. Prefix wine-predictors:/customer-predictors: is outside the hash. NLS group is nls-id:+unchanged original ID token, with no hash. Generic split accepts the declared caller group IDs; it does not create fingerprints.",
  "engineSHA256": "9e1d540ba949f7184e261459c7f192470476c93e025920da1566ca8ac6af57a9",
  "arithmetic": "Exact decimal rational algebra in web/Python; R companion numerical approximation as documented. Unsupported inputs rejected; missing/zero/undefined remain distinct."
}
