Skip to content

Commit 93801b4

Browse files
committed
T1.28a: the payload's schema per kind of task, so a classification missing its classes fails the lock
The payload's schema was derived over one target and one set of options holding what either kind writes, each kind's members optional, so a classification's payload missing its classes, or a binary task's its positive class, passed the lock (T1.28w's every_one_step_change test, once base.binary materializes). StatePayload's task is now its first parameter (K, a regression's Task by default), and the schema is derived over each kind: AnyTask, a regression's, a binary and a multiclass task, each with its kind's name and its target's members required as that kind writes them; AnyConfig, a regression's and a classification's options, the class shuffle the reader's to leave out. Contract version 19's working entry rewritten. payload_lock.rs follows the shapes per kind. Signed-off-by: Adi Wadaskar <awadaskar@nvidia.com>
1 parent 3bc0046 commit 93801b4

6 files changed

Lines changed: 690 additions & 226 deletions

File tree

‎docs/design/rust-core/phase-1/decisions.md‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# The contract schema lock: one line per version; see scripts/rust_core/contract_lock.py.
2-
19 sha256:3ae7e4fbec46cc324e60d4765f3a569b1e80bf6528d4d61d4b6916ac7a393b74 sdm-contract-19.json
2+
19 sha256:e11a6ebeafd79f29e241bc29361ed312d64768a4d8fb132afcbc6b88eb9a2f31 sdm-contract-19.json

‎rust/crates/sdm-contract/schema/sdm-contract-19.json‎

Lines changed: 242 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1894,65 +1894,188 @@
18941894
"type": "string"
18951895
},
18961896
"task": {
1897-
"description": "What is predicted, of which entity.",
1898-
"type": "object",
1899-
"properties": {
1900-
"kind": {
1901-
"description": "The task's kind, as the engine names it (`regression`,\n`binary_classification`, `multiclass_classification`).",
1902-
"type": "string"
1903-
},
1904-
"target": {
1905-
"description": "The label column of the instance table; a classification's names its\nclasses, and a binary task's its positive class. The schema of\n[`Target`] and [`ClassTarget`] at once, for the schema only.",
1897+
"description": "What is predicted, of which entity: a task of each kind, its kind's\nname and its target. The schema of [`Task`] of each target, for the\nschema only.",
1898+
"anyOf": [
1899+
{
1900+
"description": "A regression's task, for the schema only.",
19061901
"type": "object",
19071902
"properties": {
1908-
"column_name": {
1909-
"type": "string"
1910-
},
1911-
"dtype": {
1912-
"description": "A column's type on the wire, as the reference's engine names it\n(`_dtype_name`, `_list_dtype_name`).",
1903+
"kind": {
19131904
"type": "string",
19141905
"enum": [
1915-
"int64",
1916-
"float32",
1917-
"float64",
1918-
"string",
1919-
"stringlist",
1920-
"bool",
1921-
"timestamp[us]"
1906+
"regression"
19221907
]
19231908
},
1924-
"classes": {
1909+
"target": {
1910+
"description": "The label column of the instance table: a regression's.",
1911+
"type": "object",
1912+
"properties": {
1913+
"column_name": {
1914+
"type": "string"
1915+
},
1916+
"dtype": {
1917+
"description": "A column's type on the wire, as the reference's engine names it\n(`_dtype_name`, `_list_dtype_name`).",
1918+
"type": "string",
1919+
"enum": [
1920+
"int64",
1921+
"float32",
1922+
"float64",
1923+
"string",
1924+
"stringlist",
1925+
"bool",
1926+
"timestamp[us]"
1927+
]
1928+
}
1929+
},
1930+
"additionalProperties": false,
1931+
"required": [
1932+
"column_name",
1933+
"dtype"
1934+
]
1935+
},
1936+
"entity_table_names": {
19251937
"type": "array",
19261938
"items": {
19271939
"type": "string"
19281940
}
19291941
},
1930-
"positive_class": {
1942+
"anchor_time_column": {
19311943
"type": "string"
19321944
}
19331945
},
19341946
"additionalProperties": false,
19351947
"required": [
1936-
"column_name",
1937-
"dtype"
1948+
"kind",
1949+
"target",
1950+
"entity_table_names"
19381951
]
19391952
},
1940-
"entity_table_names": {
1941-
"type": "array",
1942-
"items": {
1943-
"type": "string"
1944-
}
1953+
{
1954+
"description": "A binary task, for the schema only.",
1955+
"type": "object",
1956+
"properties": {
1957+
"kind": {
1958+
"type": "string",
1959+
"enum": [
1960+
"binary_classification"
1961+
]
1962+
},
1963+
"target": {
1964+
"description": "A binary task's label column: its classes and positive class.",
1965+
"type": "object",
1966+
"properties": {
1967+
"column_name": {
1968+
"type": "string"
1969+
},
1970+
"dtype": {
1971+
"description": "A column's type on the wire, as the reference's engine names it\n(`_dtype_name`, `_list_dtype_name`).",
1972+
"type": "string",
1973+
"enum": [
1974+
"int64",
1975+
"float32",
1976+
"float64",
1977+
"string",
1978+
"stringlist",
1979+
"bool",
1980+
"timestamp[us]"
1981+
]
1982+
},
1983+
"classes": {
1984+
"type": "array",
1985+
"items": {
1986+
"type": "string"
1987+
}
1988+
},
1989+
"positive_class": {
1990+
"type": "string"
1991+
}
1992+
},
1993+
"additionalProperties": false,
1994+
"required": [
1995+
"column_name",
1996+
"dtype",
1997+
"classes",
1998+
"positive_class"
1999+
]
2000+
},
2001+
"entity_table_names": {
2002+
"type": "array",
2003+
"items": {
2004+
"type": "string"
2005+
}
2006+
},
2007+
"anchor_time_column": {
2008+
"type": "string"
2009+
}
2010+
},
2011+
"additionalProperties": false,
2012+
"required": [
2013+
"kind",
2014+
"target",
2015+
"entity_table_names"
2016+
]
19452017
},
1946-
"anchor_time_column": {
1947-
"description": "The instance table's column holding each example's anchor time,\nwhere the examples have one.",
1948-
"type": "string"
2018+
{
2019+
"description": "A multiclass task, for the schema only.",
2020+
"type": "object",
2021+
"properties": {
2022+
"kind": {
2023+
"type": "string",
2024+
"enum": [
2025+
"multiclass_classification"
2026+
]
2027+
},
2028+
"target": {
2029+
"description": "A multiclass task's label column: its classes, no positive class.",
2030+
"type": "object",
2031+
"properties": {
2032+
"column_name": {
2033+
"type": "string"
2034+
},
2035+
"dtype": {
2036+
"description": "A column's type on the wire, as the reference's engine names it\n(`_dtype_name`, `_list_dtype_name`).",
2037+
"type": "string",
2038+
"enum": [
2039+
"int64",
2040+
"float32",
2041+
"float64",
2042+
"string",
2043+
"stringlist",
2044+
"bool",
2045+
"timestamp[us]"
2046+
]
2047+
},
2048+
"classes": {
2049+
"type": "array",
2050+
"items": {
2051+
"type": "string"
2052+
}
2053+
}
2054+
},
2055+
"additionalProperties": false,
2056+
"required": [
2057+
"column_name",
2058+
"dtype",
2059+
"classes"
2060+
]
2061+
},
2062+
"entity_table_names": {
2063+
"type": "array",
2064+
"items": {
2065+
"type": "string"
2066+
}
2067+
},
2068+
"anchor_time_column": {
2069+
"type": "string"
2070+
}
2071+
},
2072+
"additionalProperties": false,
2073+
"required": [
2074+
"kind",
2075+
"target",
2076+
"entity_table_names"
2077+
]
19492078
}
1950-
},
1951-
"additionalProperties": false,
1952-
"required": [
1953-
"kind",
1954-
"target",
1955-
"entity_table_names"
19562079
]
19572080
},
19582081
"schema": {
@@ -2330,46 +2453,88 @@
23302453
"type": "boolean"
23312454
},
23322455
"inference_config": {
2333-
"description": "The engine's inference options, as it writes them: a classification's\nwith its class shuffle, a regression's with its target transforms and\noutput type. The schema of [`InferenceConfig`] and\n[`ClassificationConfig`] at once, for the schema only.",
2334-
"type": "object",
2335-
"properties": {
2336-
"kind": {
2337-
"type": "string"
2338-
},
2339-
"num_estimators": {
2340-
"type": "integer",
2341-
"format": "uint64",
2342-
"minimum": 0
2343-
},
2344-
"column_shuffle": {
2345-
"type": "boolean"
2346-
},
2347-
"category_shuffle": {
2348-
"type": "boolean"
2349-
},
2350-
"hop_shuffle": {
2351-
"type": "boolean"
2352-
},
2353-
"class_shuffle": {
2354-
"type": "boolean"
2355-
},
2356-
"target_transforms": {
2357-
"type": "array",
2358-
"items": {
2359-
"type": "string"
2360-
}
2456+
"description": "The engine's inference options, a regression's or a classification's:\nthe schema of [`InferenceConfig`] and [`ClassificationConfig`], for the\nschema only.",
2457+
"anyOf": [
2458+
{
2459+
"description": "A regression's inference options, as the engine writes them\n(`_inference_config_to_json`).",
2460+
"type": "object",
2461+
"properties": {
2462+
"kind": {
2463+
"type": "string"
2464+
},
2465+
"num_estimators": {
2466+
"type": "integer",
2467+
"format": "uint64",
2468+
"minimum": 0
2469+
},
2470+
"column_shuffle": {
2471+
"type": "boolean"
2472+
},
2473+
"category_shuffle": {
2474+
"type": "boolean"
2475+
},
2476+
"hop_shuffle": {
2477+
"type": "boolean"
2478+
},
2479+
"class_shuffle": {
2480+
"description": "The reader's, not the writer's: a regression's options hold none.",
2481+
"type": "boolean"
2482+
},
2483+
"target_transforms": {
2484+
"type": "array",
2485+
"items": {
2486+
"type": "string"
2487+
}
2488+
},
2489+
"output_type": {
2490+
"type": "string"
2491+
}
2492+
},
2493+
"additionalProperties": false,
2494+
"required": [
2495+
"kind",
2496+
"num_estimators",
2497+
"column_shuffle",
2498+
"category_shuffle",
2499+
"hop_shuffle",
2500+
"target_transforms",
2501+
"output_type"
2502+
]
23612503
},
2362-
"output_type": {
2363-
"type": "string"
2504+
{
2505+
"description": "A classification's inference options, its class shuffle the reader's\nto leave out: the schema of [`ClassificationConfig`], for the schema\nonly.",
2506+
"type": "object",
2507+
"properties": {
2508+
"kind": {
2509+
"type": "string"
2510+
},
2511+
"num_estimators": {
2512+
"type": "integer",
2513+
"format": "uint64",
2514+
"minimum": 0
2515+
},
2516+
"column_shuffle": {
2517+
"type": "boolean"
2518+
},
2519+
"category_shuffle": {
2520+
"type": "boolean"
2521+
},
2522+
"hop_shuffle": {
2523+
"type": "boolean"
2524+
},
2525+
"class_shuffle": {
2526+
"type": "boolean"
2527+
}
2528+
},
2529+
"additionalProperties": false,
2530+
"required": [
2531+
"kind",
2532+
"num_estimators",
2533+
"column_shuffle",
2534+
"category_shuffle",
2535+
"hop_shuffle"
2536+
]
23642537
}
2365-
},
2366-
"additionalProperties": false,
2367-
"required": [
2368-
"kind",
2369-
"num_estimators",
2370-
"column_shuffle",
2371-
"category_shuffle",
2372-
"hop_shuffle"
23732538
]
23742539
}
23752540
},

0 commit comments

Comments
 (0)