Datasets:
source_id stringlengths 9 9 | serving_size_g float64 14 45 | servings_per_container float64 1 58 | calories float64 60 220 | total_fat_g float64 1.5 15 | sodium_mg float64 5 410 | carbs_g float64 10 29 | sugar_g float64 0 23 | protein_g float64 0.5 10 | category stringclasses 5
values | parent_id stringlengths 9 9 | augmentation stringclasses 1
value | is_augmented bool 1
class | second_parent_id stringlengths 9 9 | mix_weight float64 1 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Snack_001 | 28 | 6 | 150 | 9 | 160 | 16 | 0.5 | 1 | chips | Snack_001 | none | false | Snack_001 | 1 |
Snack_002 | 28 | 15 | 160 | 10 | 180 | 15 | 1 | 2 | chips | Snack_002 | none | false | Snack_002 | 1 |
Snack_003 | 28 | 7 | 140 | 6 | 110 | 19 | 2 | 2 | chips | Snack_003 | none | false | Snack_003 | 1 |
Snack_004 | 28 | 5 | 150 | 8 | 190 | 18 | 0.5 | 2 | chips | Snack_004 | none | false | Snack_004 | 1 |
Snack_005 | 28 | 9 | 160 | 11 | 210 | 15 | 0 | 1 | chips | Snack_005 | none | false | Snack_005 | 1 |
Snack_006 | 28 | 24 | 150 | 8 | 115 | 17 | 0 | 2 | chips | Snack_006 | none | false | Snack_006 | 1 |
Snack_007 | 14 | 26 | 60 | 2.5 | 140 | 10 | 2 | 0.5 | crackers | Snack_007 | none | false | Snack_007 | 1 |
Snack_008 | 16 | 28 | 70 | 1.5 | 135 | 12 | 0 | 1 | crackers | Snack_008 | none | false | Snack_008 | 1 |
Snack_009 | 39 | 8 | 200 | 10 | 290 | 23 | 5 | 4 | crackers | Snack_009 | none | false | Snack_009 | 1 |
Snack_010 | 16 | 24 | 80 | 4.5 | 130 | 10 | 1 | 0.5 | crackers | Snack_010 | none | false | Snack_010 | 1 |
Snack_011 | 30 | 1 | 130 | 8 | 410 | 10 | 2 | 10 | crackers | Snack_011 | none | false | Snack_011 | 1 |
Snack_012 | 15 | 36 | 70 | 2.5 | 120 | 10 | 2 | 1 | crackers | Snack_012 | none | false | Snack_012 | 1 |
Snack_013 | 28 | 1 | 140 | 5 | 110 | 21 | 11 | 1 | cookies | Snack_013 | none | false | Snack_013 | 1 |
Snack_014 | 28 | 1 | 140 | 7 | 75 | 19 | 8 | 1 | cookies | Snack_014 | none | false | Snack_014 | 1 |
Snack_015 | 28 | 7 | 140 | 7 | 160 | 18 | 12 | 2 | cookies | Snack_015 | none | false | Snack_015 | 1 |
Snack_016 | 31 | 8 | 130 | 5 | 85 | 21 | 12 | 1 | cookies | Snack_016 | none | false | Snack_016 | 1 |
Snack_017 | 44 | 10 | 220 | 10 | 140 | 29 | 14 | 2 | cookies | Snack_017 | none | false | Snack_017 | 1 |
Snack_018 | 31 | 8 | 150 | 6 | 115 | 23 | 12 | 2 | cookies | Snack_018 | none | false | Snack_018 | 1 |
Snack_019 | 17 | 5 | 80 | 4 | 40 | 10 | 9 | 1 | candy | Snack_019 | none | false | Snack_019 | 1 |
Snack_020 | 42 | 36 | 210 | 11 | 20 | 28 | 23 | 2 | candy | Snack_020 | none | false | Snack_020 | 1 |
Snack_021 | 21 | 2 | 120 | 8 | 20 | 11 | 10 | 2 | candy | Snack_021 | none | false | Snack_021 | 1 |
Snack_022 | 30 | 33 | 150 | 7 | 60 | 20 | 15 | 1 | candy | Snack_022 | none | false | Snack_022 | 1 |
Snack_023 | 30 | 2 | 170 | 11 | 90 | 15 | 12 | 3 | candy | Snack_023 | none | false | Snack_023 | 1 |
Snack_024 | 30 | 3.5 | 140 | 6 | 90 | 20 | 12 | 3 | candy | Snack_024 | none | false | Snack_024 | 1 |
Snack_025 | 36 | 15 | 200 | 12 | 80 | 21 | 9 | 2 | granola_bars | Snack_025 | none | false | Snack_025 | 1 |
Snack_026 | 24 | 58 | 100 | 3.5 | 70 | 17 | 7 | 1 | granola_bars | Snack_026 | none | false | Snack_026 | 1 |
Snack_027 | 45 | 1 | 200 | 11 | 110 | 21 | 7 | 7 | granola_bars | Snack_027 | none | false | Snack_027 | 1 |
Snack_028 | 40 | 12 | 190 | 15 | 140 | 16 | 5 | 6 | granola_bars | Snack_028 | none | false | Snack_028 | 1 |
Snack_029 | 43 | 2 | 200 | 11 | 60 | 22 | 9 | 5 | granola_bars | Snack_029 | none | false | Snack_029 | 1 |
Snack_030 | 24 | 40 | 100 | 3 | 5 | 17 | 6 | 2 | granola_bars | Snack_030 | none | false | Snack_030 | 1 |
24-679 (Fall 2026): Packaged Snack Nutrition
shanexf/packaged-snack-nutrition-data
Nutrition Facts values for 30 packaged snack products, hand-collected from package labels, plus
explicitly marked synthetic variants. The classroom task is multiclass classification: predict the
snack category (chips, crackers, cookies, candy, granola_bars) from eight per-serving nutrition numbers.
Purpose
Built for the 24-679 (Fall 2026, Carnegie Mellon University) assignment on building and augmenting a small tabular dataset. It exists to practice data contracts, provenance tracking, label-preserving augmentation, and honest documentation on a dataset small enough to inspect row by row. It is a teaching artifact, not a nutrition reference.
Composition
Each row is one packaged snack product (or a synthetic variant of one). There are 30 unique real products, six in each of five shelf categories (chips, crackers, cookies, candy, granola_bars). Every row carries eight numeric features, the category target, and provenance fields. No text, images, or personal data are included.
| Stored field / group | Meaning and modeling role |
|---|---|
serving_size_g, servings_per_container |
Continuous features from the label; strictly positive. |
calories, total_fat_g, sodium_mg, carbs_g, sugar_g, protein_g |
Continuous per-serving nutrition features; nonnegative; sugar never exceeds carbs. |
category |
Nominal classification target with five classes. Synthetic rows inherit it from their parents. |
source_id, parent_id, second_parent_id |
Unique example key and original source keys; provenance only. |
augmentation, is_augmented, mix_weight |
Method, synthetic flag, and primary-parent weight; exclude from predictors. |
Numeric features are stored as floats in every split. The machine-readable feature metadata at the top of this card preserves every exact column name and storage type.
Collection
The 30 products were selected and measured by the author in September 2026. All eight features were
transcribed directly from each product's printed Nutrition Facts panel (serving size in grams,
servings per container, and per-serving calories, total fat, sodium, total carbohydrate, sugar, and
protein). The category is the type of snack the product is sold as, recorded at collection time. The
preparation notebook reads
Package food nutritional value.csv, keeps the collected sample_id as source_id, and checks that
every value is finite and nonnegative, that serving fields are positive, that sugar never exceeds
total carbohydrate. These checks establish
valid domains, not the accuracy of a manufacturer's label.
Labels
category is the prediction target, with five balanced classes in the original split (six products
each). It is a property of the product type, assigned at collection, not a threshold applied to any
nutrition value; the model's job is to recover it from nutrition alone. Synthetic rows always inherit
the label of their parent(s), so no augmentation method creates, flips, or blends a label.
Preprocessing and augmentation
Original rows were randomly partitioned into train, validation, and test before augmentation (holdout fraction 30%, stratified by category, seed 24679; test receives 50% of that holdout, seed 24680). Only training rows serve as parents. This run requests 5 copies per method and training row before filtering; unchanged rows and repeated feature combinations for a given primary parent are removed. Every synthetic value is rounded to the resolution printed on a Nutrition Facts label (1 g serving size, 0.5 servings, 5 kcal, 0.5 g fat/sugar/protein, 5 mg sodium, 1 g carbohydrate) and clipped to its domain.
- Additive numeric jitter: Gaussian noise on every feature with standard deviation max(5% of the training IQR, one label step). Justification: mimics label rounding and small formulation differences between batches or brands.
- Multiplicative numeric scaling: each feature multiplied by an independent factor in 0.90–1.10. Justification: mimics a slightly different serving size or a near-identical product from another brand.
- Within-class Mixup: two distinct training parents from the same category blended with one primary weight in 0.60–0.90 across all eight features. Justification: a convex combination of two cookies is a plausible cookie, and the shared class makes the label unambiguous.
- Within-class nearest-neighbor interpolation (SMOTE-style): a child placed at a uniform step between a training product and one of its 3 nearest same-category neighbors in standardized feature space. Justification: fills locally dense regions of each class rather than spanning the whole class.
All four methods are label-preserving by construction and every child records its parent(s) and
weight. Original and single-parent rows repeat the primary key in second_parent_id and use
mix_weight=1.0. Categorical perturbation and CTGAN are not used.
| Augmentation method | Stored rows |
|---|---|
additive_numeric_jitter |
105 |
multiplicative_numeric_scale |
105 |
within_class_mixup |
99 |
within_class_neighbor_interpolation |
90 |
Splits
These counts are computed from the packaged splits for this run.
| Split | Original rows | Synthetic rows | Total rows |
|---|---|---|---|
| original | 30 | 0 | 30 |
| augmented | 0 | 399 | 399 |
| train | 21 | 399 | 420 |
| validation | 4 | 0 | 4 |
| test | 5 | 0 | 5 |
| Split | category | Rows |
|---|---|---|
| original | candy | 6 |
| original | chips | 6 |
| original | cookies | 6 |
| original | crackers | 6 |
| original | granola_bars | 6 |
| augmented | candy | 76 |
| augmented | chips | 74 |
| augmented | cookies | 76 |
| augmented | crackers | 96 |
| augmented | granola_bars | 77 |
| train | candy | 80 |
| train | chips | 78 |
| train | cookies | 80 |
| train | crackers | 101 |
| train | granola_bars | 81 |
| validation | candy | 1 |
| validation | chips | 1 |
| validation | cookies | 1 |
| validation | granola_bars | 1 |
| test | candy | 1 |
| test | chips | 1 |
| test | cookies | 1 |
| test | crackers | 1 |
| test | granola_bars | 1 |
original holds the 30 collected rows unchanged and augmented holds only synthetic rows; these two
splits are the assignment deliverable. train = training originals + every synthetic row;
validation and test = untouched holdout originals. Every parent of every synthetic row is a
training original, so no holdout product has a synthetic child anywhere in the dataset, and
augmented is exactly the synthetic portion of train. Keep these boundaries fixed for downstream
comparisons; changing or reordering the source CSV changes them.
Intended use and limitations
Use for teaching tabular data contracts, provenance, augmentation, and small-sample multiclass
classification. Compare training on the original training rows alone against the train split, using
the same validation and test rows; report accuracy and macro-F1 against a majority-class baseline.
With four or five holdout rows per partition, scores will be noisy.
Limitations: thirty products from a small number of brands and one shopper's selection do not represent the packaged-food market. Categories overlap in nutrition space (a sweet granola bar can resemble a cookie), and the category boundary is a shelf convention, not a nutrition fact. Synthetic rows add spread around real products but not new independent products, and a domain-valid synthetic row may still describe a product nobody sells. Nutrition label values are manufacturer-reported and rounded.
Ethical notes
The data describe products, not people; no personal information, purchase history, or consumption data is included, and the collector is not identifiable from the rows. Values were transcribed from public package labels; brand and product names are deliberately omitted so no manufacturer is singled out. The category label is a descriptive shelf category and carries no health judgment. Do not use this dataset for nutrition guidance, dietary advice, product ranking, or any consequential decision.
License
Released under CC BY 4.0. Nutrition Facts values are factual data; the compilation, labels, synthetic rows, and this documentation are the author's contribution and may be reused with attribution.
AI usage disclosure
The preparation notebook and this card were written with assistance from Claude (Anthropic), using the 24-679 Tabular Data class notebook as the template. The product selection, all 30 measurements, and the category labels were collected by the author without AI. The author reviewed, ran, and verified every step of the notebook and is responsible for the dataset and its documentation.
Load
from datasets import load_dataset
ds = load_dataset("shanexf/packaged-snack-nutrition-data")
original, augmented = ds["original"], ds["augmented"]
# Train with ds["train"], choose settings with ds["validation"], then score ds["test"].
Regenerate this card with the preparation notebook after changing the data; its counts are calculated from the actual packaged splits. The YAML schema and split configuration are preserved from the upload.
- Downloads last month
- 51