Member Junction
    Preparing search index...

    Locked-holdout carves. Ordering is OrdinalCompare from @memberjunction/global (locale-independent), so results never depend on the host's locale.

    Index

    Constructors

    Methods

    • The date carve: holdout = carve date ≥ cutoff and < holdoutEnd (when set); development = before the cutoff.

      Parameters

      • rows: readonly CarveRow[]
      • holdout: {
            cutoff: string;
            dateColumn: string;
            holdoutEnd: string | null;
            kind: "date-carved";
            newEntityReport: { groupKey: string; holdoutFraction: number } | null;
        }
        • Readonlycutoff: string
        • ReadonlydateColumn: string
        • ReadonlyholdoutEnd: string | null

          Optional end (exclusive) of the holdout window; rows on or after it are in neither role (it reproduces the reference pipeline's holdout keys).

        • Readonlykind: "date-carved"
        • ReadonlynewEntityReport: { groupKey: string; holdoutFraction: number } | null

      Returns CarveResult

    • The distinct period starts (ISO dates, UTC) of the given dates, in order: one out-of-time slice per period. Weeks start on Monday, quarters on 1 January, April, July and October. Throws HoldoutCarveDateError on a date it cannot read.

      Parameters

      • dates: readonly string[]
      • period: "year" | "month" | "day" | "week" | "quarter"

      Returns readonly string[]

    • The last origins × horizonPeriods distinct periods are the holdout (the trainer's outer origins). The series must keep minTrainPeriods periods before the first origin's gap, as the trainer requires of its first origin.

      Parameters

      • rows: readonly PeriodRow[]
      • holdout: {
            gapPeriods: number;
            horizonPeriods: number;
            kind: "rolling-origin";
            minTrainPeriods: number;
            origins: number;
            window: "expanding" | "sliding";
        }

      Returns RollingOriginCarveResult

    • The holdout is every row whose group key's hash of <seed>:<groupKey>, read as a fraction of 2^32, is below fraction. Rows that share a group key (one person's several rows) share one hash, so a group is wholly held out or wholly in development and never straddles the split. A row's role depends only on the seed and its group key, so it never changes with the read order or with other rows. Both id lists are sorted by row id.

      Parameters

      Returns SeededRandomCarveResult

    • The development row ids of a snapshot manifest: the set a scored record's inTraining flag reads (a record whose id is in it was a training row). Row ids, not entity keys: the same rule holds for one-row-per-record units and for units with a row per record per period.

      Parameters

      Returns ReadonlySet<string>

    • The earliest 1 January whose trailing block (dates on or after it) holds at most maxShare of the rows; at least the last year's 1 January. Throws HoldoutCarveDateError on a date it cannot read (a dropped date would shrink the denominator), and a RangeError when there is no date or the cutoff would leave no row before it.

      Parameters

      • dates: readonly string[]
      • maxShare: number = DEFAULT_YEAR_CUTOFF_SHARE

      Returns string