From e0a46bef7a974b619dd32b0fba44db6d0167cd99 Mon Sep 17 00:00:00 2001 From: igutierrez Date: Sat, 21 Nov 2026 17:54:20 -0600 Subject: [PATCH] agent-skills: ask whether open-vocabulary strings are categories or free text (data-prep case 32) Adds a Column types pass to the graph gate and documents the 4,000-distinct-value cut-off between categorical and text. Co-Authored-By: Claude Opus 5.5 --- .../skills/hosts/snowflake-coco/adapter.md | 4 +++- .../skills/kumo-data-science/SKILL.md | 10 ++++++++ .../kumo-data-science/accept/preflight.md | 8 +++++-- .../references/graph_construction.md | 23 +++++++++++++++++++ 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/agent-skills/skills/hosts/snowflake-coco/adapter.md b/agent-skills/skills/hosts/snowflake-coco/adapter.md index e9c4349cb..9e9fb5437 100644 --- a/agent-skills/skills/hosts/snowflake-coco/adapter.md +++ b/agent-skills/skills/hosts/snowflake-coco/adapter.md @@ -45,7 +45,9 @@ must be kept. Never relabel natural-language content as categorical to dodge the is a host restriction, not a portable Kumo restriction. Preflight cannot predict Kumo's sampled type inference, so a column name is not proof either way: -at the graph gate, exclude only columns whose text semantics are already established. The +at the graph gate, exclude only columns whose text semantics are already established, and put an +open-vocabulary string whose type is not settled to the user as a `Column types` line +(`kumoai-reference/references/graph_construction.md` *How a semantic type is inferred*). The generated code carries the runtime guard, because the user may run it without the agent: after `infer_metadata()` and the `with_column` corrections, and before `graph.snapshot()`, emit a cell that fails on any retained `Stype.text` column. diff --git a/agent-skills/skills/kumo-data-science/SKILL.md b/agent-skills/skills/kumo-data-science/SKILL.md index 0668c6cf5..fd92fba98 100644 --- a/agent-skills/skills/kumo-data-science/SKILL.md +++ b/agent-skills/skills/kumo-data-science/SKILL.md @@ -207,6 +207,16 @@ Carry the confirmed exclusion set into code generation: a table with any exclusi with an explicit positional column list, because omitting it silently restores every source column. +**Column types.** `infer_metadata()` types each column from its name, its physical type and its +sampled values (`kumoai-reference/references/graph_construction.md` *How a semantic type is +inferred*), and those rules can contradict what a column means. Add a `Column types` section to +the proposal with one line for every selected non-key column a rule there matches: the type Kumo +will give it, the rule behind it, and the type its meaning calls for. Where the two differ, the +choice is the user's, at this gate; the notebook declares the confirmed type with +`with_column(...)`. A type confirmed here is a declaration, like a foreign key's `ID` — not a +change made to silence a data message (`kumoai-reference/references/troubleshooting_signals.md` +§1a). + **Assert what preflight could not find.** The proposal must state these explicitly rather than leaving them unmentioned, because each one changes whether the task is expressible: diff --git a/agent-skills/skills/kumo-data-science/accept/preflight.md b/agent-skills/skills/kumo-data-science/accept/preflight.md index abed8b5ba..92f0dfbfa 100644 --- a/agent-skills/skills/kumo-data-science/accept/preflight.md +++ b/agent-skills/skills/kumo-data-science/accept/preflight.md @@ -217,6 +217,10 @@ Excluded columns - fraud_events.DAYS_TO_RESOLVE [inferred] — duration of an interval that has not ended yet - ... +Column types +- . [inferred] — Kumo: (); its meaning: — +- ... + Not found - payments: no primary key inferred [inferred] — treated as keyless; edge source only unless corrected - events: no usable time column [inferred] — a time-ranged target cannot reference this table @@ -225,8 +229,8 @@ Not found Confirm, or correct any line (your values take precedence). ``` -`Excluded columns` and `Not found` are local availability-gate extensions to the confirmation -format. +`Excluded columns`, `Column types` and `Not found` are local availability-gate extensions to the +confirmation format. `Column types` follows router Node 1c, *Column types*. ## 9. Never diff --git a/agent-skills/skills/kumoai-reference/references/graph_construction.md b/agent-skills/skills/kumoai-reference/references/graph_construction.md index 5995891ff..5c27461d6 100644 --- a/agent-skills/skills/kumoai-reference/references/graph_construction.md +++ b/agent-skills/skills/kumoai-reference/references/graph_construction.md @@ -183,6 +183,29 @@ Rules: - Both `dtype` and `stype` must be resolved before a table is used in a `PredictiveQuery`; `infer_metadata()` resolves whatever is missing. +### How a semantic type is inferred + +For a column with no declared type, `infer_metadata()` reads, in order: its role (a primary key +is `ID`, a time column `timestamp`), its physical type (date, time, boolean and list types decide +on their own), its **name**, and then its **values**, in a sample of up to 10,000 rows. The first +that decides wins. The name and value rules below can contradict what a column means; the graph +gate reports each selected column they match (router Node 1c, *Column types*), and a confirmed +correction is declared with `with_column`. + +- **A string is a category or free text by its distinct count.** A string column that is not a + key, not typed by its name and not split as a list is typed `categorical` with at most 4,000 + distinct sampled values and `text` above that. The count decides, not the meaning: an + open-vocabulary attribute — a place name, a job title, a product or company name, a short + description — is a category in a small table and free text in a large one, and can change type + when the data grows. Closed sets (a status, a tier, a channel) are categorical either way and + need no line. For each selected open-vocabulary string, report the type you expect and the + 4,000 cut-off behind it, ask whether it is a category or free text, and declare the answer + (`Stype.categorical` or `Stype.text`) so a refresh cannot flip it. Above 4,000 distinct values + a category exceeds what the categorical encoder represents. Where the host adapter makes text + features unavailable, a column the user calls free text is excluded, and the proposal says so. + +Source: shipped package (`kumo_core.stype_inference`, `kumo.engine.table`) + --- ## Step 4: build the graph