concept

AI samples, features and labels

A sample is the prediction unit; features are inputs available by the decision time; the label is the target observed for supervised training. Keep feature order and sample alignment stable. Exclude future information and distinguish observed sales from unconstrained demand.

Formal Syntax & Structure

artificial-intelligence syntaxartificial-intelligence
AI samples, features and labels

Working Example

Example Snippetartificial-intelligence
def make_features(record):    return [record["weekend"], record["opening_stock"]]
records = [    {"weekend": 0, "opening_stock": 12, "units_sold": 7},    {"weekend": 1, "opening_stock": 10, "units_sold": 10},    {"weekend": 0, "opening_stock": 8, "units_sold": 4},]features = []labels = []for record in records:    features.append(make_features(record))    labels.append(record["units_sold"])print(features)print(labels)print(make_features({"weekend": 1, "opening_stock": 15}))