featurizer × dirtyduck

Which food facilities are likely to fail an inspection? (facilities ← inspections)

all-agg config · 272 features · v0.6.0 · live-DB validated

What changed since the Jul-6 snapshot. v0.6.0 rewrote the correlated-subquery aggregator tier to set-based pre-aggregation (one window pre-pass + GROUP BY per family, ADR-0010). This revalidation first fixed a latent SyntaxError: an over-63-byte companion-CTE name was hash-capped with a ~ separator and emitted unquoted, which PostgreSQL parses as an operator — it hard-blocked the all-agg config on data with long categorical column names (this DB). Result (measured, not projected): the all-agg matrix now materializes on every live DB (it previously errored or would not finish). The times are honest, though: on the larger event streams the advanced tier is still heavy — well above ADR-0010's synthetic <120 s target (that target was never actually run on this DB, since the config SyntaxError'd). The wide variant (all-agg × 14 transformers) still trips unguarded ln/sqrt on negative/zero inputs — the known math-hardening follow-up, not a v0.6.0 regression.

1 · Featurizer configuration

target
facilities
max_depth
2
intervals
P1M, P3M, P6M
entities
facilities, inspections
relationships
facilities.entity_id ← inspections.entity_id (as-of)
aggregations
the 65-primitive default-active set (incl. the set-based gap/categorical/sequence families)

2 · Live database structure

Event knowledge dates span 2014-01-022017-12-29.

ontology.entities — 22169 rows

columntype
entity_idbigint
license_numinteger
facilitytext
facility_akatext
facility_typetext
addresstext
zip_codetext
locationUSER-DEFINED
start_timedate
end_timedate
activity_perioddaterange

ontology.events — 74191 rows

columntype
event_idinteger
entity_idbigint
typeUSER-DEFINED
datedate
riskUSER-DEFINED
resultUSER-DEFINED
violationsjsonb

3 · Full-cohort materialization (v0.6.0)

Each variant materialized through featurizer's grouped/TEMP-shard path (to_dataframe(connection=…)) at one as-of date; no permanent writes. narrow = the triage config's own primitives; all-agg = the full 65-aggregator default set with identity; wide = all-agg × 14 transformers (lags, rolling, EMA, cusum…).

variantfeaturesshardsrowscolsdup-namessecondsstatus
narrow14712216914703.4materialized
all-agg2721221692720356.8materialized
wideRuntimeError: Featurizer materialized query execution failed (cannot take logarithm of a negaterr

shards = ⌈features / 1664⌉ group-queries (PostgreSQL's per-row column cap); dup-names = duplicate output column identifiers (0 = the 63-byte-cap hashing is collision-free).

4 · Generated features — a sample

Full intended label, the rendered short-name (the ≤63-byte column identifier; hash-capped when long), kind, a generated description, and a few real values from the live DB.

labelshort-name (column)kinddescriptionvalues
facilities.facility_type=bakeryfacilities.facility_type=bakeryone_hot1 when facilities.facility_type = 'bakery', else 0 (fixed-vocabulary one-hot; NULL/out-of-vocabulary rows are all-zero)0, 0, 0
facilities.facility_type=cateringfacilities.facility_type=cateringone_hot1 when facilities.facility_type = 'catering', else 0 (fixed-vocabulary one-hot; NULL/out-of-vocabulary rows are all-zero)0, 0, 0
facilities.facility_type=children's services facilityfacilities.facility_type=children's services facilityone_hot1 when facilities.facility_type = 'children's services facility', else 0 (fixed-vocabulary one-hot; NULL/out-of-vocabulary rows are all-zero)0, 1, 0
facilities.facility_type=daycare (2 - 6 years)facilities.facility_type=daycare (2 - 6 years)one_hot1 when facilities.facility_type = 'daycare (2 - 6 years)', else 0 (fixed-vocabulary one-hot; NULL/out-of-vocabulary rows are all-zero)1, 0, 0
facilities.facility_type=daycare above and under 2 yearsfacilities.facility_type=daycare above and under 2 yearsone_hot1 when facilities.facility_type = 'daycare above and under 2 years', else 0 (fixed-vocabulary one-hot; NULL/out-of-vocabulary rows are all-zero)0, 0, 0
BURSTINESS(inspections.date)BURSTINESS(inspections.date)derivedGoh-Barabasi burstiness index (-1 to 1), applied to inspections.date∅, -0.3097720994773271657, -0.6389954919812702494
BURSTINESS(inspections.date|interval=P1M)BURSTINESS(inspections.date|interval=P1M)derivedGoh-Barabasi burstiness index (-1 to 1), applied to inspections.date, over the trailing P1M window∅, ∅, ∅
BURSTINESS(inspections.date|interval=P3M)BURSTINESS(inspections.date|interval=P3M)derivedGoh-Barabasi burstiness index (-1 to 1), applied to inspections.date, over the trailing P3M window∅, ∅, ∅
BURSTINESS(inspections.date|interval=P6M)BURSTINESS(inspections.date|interval=P6M)derivedGoh-Barabasi burstiness index (-1 to 1), applied to inspections.date, over the trailing P6M window∅, ∅, ∅
ENTROPY(inspections.result)ENTROPY(inspections.result)derivedShannon entropy of categorical distribution, applied to inspections.result0.693, -0, -0
ENTROPY(inspections.result|interval=P1M)ENTROPY(inspections.result|interval=P1M)derivedShannon entropy of categorical distribution, applied to inspections.result, over the trailing P1M window∅, -0, ∅
ENTROPY(inspections.result|interval=P3M)ENTROPY(inspections.result|interval=P3M)derivedShannon entropy of categorical distribution, applied to inspections.result, over the trailing P3M window∅, -0, ∅
ENTROPY(inspections.result|interval=P6M)ENTROPY(inspections.result|interval=P6M)derivedShannon entropy of categorical distribution, applied to inspections.result, over the trailing P6M window∅, -0, ∅
ENTROPY(inspections.risk)ENTROPY(inspections.risk)derivedShannon entropy of categorical distribution, applied to inspections.risk-0, -0, -0
ENTROPY(inspections.risk|interval=P1M)ENTROPY(inspections.risk|interval=P1M)derivedShannon entropy of categorical distribution, applied to inspections.risk, over the trailing P1M window∅, -0, ∅
AGE_IN_SYSTEM(inspections.date)AGE_IN_SYSTEM(inspections.date)derivedAlias of tenure: days since the first observed event, applied to inspections.date1460, 1460, 1460
AGE_IN_SYSTEM(inspections.date|interval=P1M)AGE_IN_SYSTEM(inspections.date|interval=P1M)derivedAlias of tenure: days since the first observed event, applied to inspections.date, over the trailing P1M window∅, 14, ∅
AGE_IN_SYSTEM(inspections.date|interval=P3M)AGE_IN_SYSTEM(inspections.date|interval=P3M)derivedAlias of tenure: days since the first observed event, applied to inspections.date, over the trailing P3M window∅, 14, ∅
AGE_IN_SYSTEM(inspections.date|interval=P6M)AGE_IN_SYSTEM(inspections.date|interval=P6M)derivedAlias of tenure: days since the first observed event, applied to inspections.date, over the trailing P6M window∅, 14, ∅

A set-based aggregator's SQL (companion pre-agg CTE, ADR-0010)

ENTROPY(inspections.result)

-SUM(freq::float / total * LN(freq::float / total))