Coffee Premium-Price AutoGluon Classifier

Model Summary

This repository contains an AutoGluon binary classifier that predicts whether a retail coffee bag is premium-priced using package attributes.

The model was developed for Homework 2 in Carnegie Mellon University's 24-679 course.

  • Author: Can Jin
  • Task: Binary tabular classification
  • Framework: AutoGluon Tabular 1.6.1
  • Selected model: WeightedEnsemble_L2
  • Validation selection metric: Balanced accuracy
  • Model repository: cannj/2026-24679-coffee-autogluon-classifier
  • Source dataset: ssg1/coffee-bags-tabular

Purpose and Intended Use

This model demonstrates how AutoML can compare classical machine-learning models on a small tabular product dataset.

Intended uses include:

  • Coursework
  • Educational AutoML demonstrations
  • Small-scale tabular-classification experiments
  • Model evaluation and documentation practice

The model is not intended for:

  • Commercial pricing decisions
  • Financial decisions
  • Product-quality rankings
  • Claims about coffee taste
  • Deployment without additional independent data

Prediction Task

The target column is is_premium.

Label Meaning
0 Standard-priced coffee
1 Premium-priced coffee

The positive class used for precision, recall, and F1 is label 1.

The source dataset defines premium-priced coffee relative to its median price per ounce. The label therefore represents relative pricing within this dataset, not a universal definition of premium coffee.

Data Origin

The source dataset was created by Hugging Face user ssg1 for Homework 1.

Dataset URL:

https://huggingface.co/datasets/ssg1/coffee-bags-tabular

The original dataset contains 34 independently collected retail coffee products:

  • 17 standard-priced products
  • 17 premium-priced products

The data describe retail products and do not contain personal or sensitive human information.

Dataset Splits

The published splits were used without reshuffling.

Split Original rows Augmented rows Total rows Purpose
Train 23 322 345 Model fitting
Validation 5 0 5 Model selection
Test 6 0 6 Final evaluation

The original products were divided into training, validation, and test groups before augmentation.

Only training originals were used as parents for augmented records. Validation and test records are original and unaugmented.

The notebook verified that parent identifiers do not cross between splits.

Input Features

The model uses seven package attributes.

Feature Type Unit or categories Description
origin Categorical Country or Blend Stated coffee origin
altitude_masl Numerical Meters above sea level Stated growing altitude
altitude_stated Binary 0 or 1 Whether altitude is stated
processing Categorical Multiple categories Processing method
roast_level Categorical Multiple categories Stated roast level
weight_g Numerical Grams Package net weight
grind Categorical Whole or ground Product grind form

Excluded Columns and Leakage Prevention

The following columns were excluded from model inputs:

Column Reason
source_id Row identifier
parent_id Augmentation provenance
augmentation Augmentation metadata
is_augmented Augmentation metadata
brand Could allow memorization of brand-specific prices
price_usd Contains direct price information
price_per_oz Directly defines the target
is_premium Prediction target

Because is_premium is derived from price per ounce, including price_usd or price_per_oz would create direct target leakage.

Source-Dataset Augmentation

The published training split contains augmented children produced by the dataset author.

The source dataset documents two augmentation approaches:

  1. Additive Gaussian jitter applied to selected numerical values.
  2. Multiplicative scaling applied to selected numerical values.

Categorical values and the binary target were inherited from the corresponding parent record.

Validation and test products were not used as augmentation parents. This model-training notebook did not generate additional synthetic records.

Preprocessing

The notebook performed the following steps:

  1. Loaded the published train, validation, and test splits.
  2. Verified that all required columns were present.
  3. Verified that selected features and targets contained no missing values.
  4. Verified that the target values were limited to 0 and 1.
  5. Verified that validation and test contained no augmented records.
  6. Verified that parent groups did not cross between splits.
  7. Removed identifiers, provenance information, brand, and price-related columns.
  8. Preserved numerical variables as numerical data.
  9. Preserved categorical variables as categorical or string data.

AutoGluon performed its own internal categorical encoding, feature transformation, and model-specific preprocessing.

No scaler or encoder was manually fitted using validation or test data.

AutoML Training Setup

Setting Value
Library AutoGluon Tabular 1.6.1
Problem type Binary classification
Positive class 1
Selection metric Balanced accuracy
Preset medium_quality
Maximum training budget 300 seconds
Bagging folds 0
Stacking levels 0
Notebook seed 24679
Validation data Published validation originals
Test data Published test originals

Bagging and stacking were disabled because the training data contain related augmented children. Randomly distributing related records across internal folds could produce optimistic performance estimates.

Search Space

This experiment used the candidate model configurations supplied by AutoGluon's medium_quality preset.

This was a budgeted AutoML model-family and configuration search rather than a manually defined exhaustive grid search.

The models fitted in this run were:

  • LightGBMXT
  • LightGBM
  • XGBoost
  • LightGBMLarge
  • WeightedEnsemble_L2
  • NeuralNetTorch
  • NeuralNetFastAI
  • RandomForestEntr
  • RandomForestGini
  • ExtraTreesGini
  • ExtraTreesEntr

The complete stored configuration for every fitted model is included in:

all_model_hyperparameters.json

The selected-model configuration is also included separately in:

best_hyperparameters.json

Validation Leaderboard

Models were ranked using validation balanced accuracy. Balanced accuracy is a unitless proportion between 0 and 1.

model score_val fit_time pred_time_val
LightGBMXT 1 3.91 0.0037
LightGBM 1 0.53 0.005
XGBoost 1 0.85 0.0052
LightGBMLarge 1 0.93 0.0064
WeightedEnsemble_L2 1 0.99 0.0072
NeuralNetTorch 1 6.09 0.0101
NeuralNetFastAI 1 1.98 0.0207
RandomForestEntr 1 0.85 0.047
RandomForestGini 1 0.89 0.0573
ExtraTreesGini 1 0.86 0.0787

Selected Model

Item Result
Selected model WeightedEnsemble_L2
Validation balanced accuracy 1.0000
Selection rule Highest validation balanced accuracy

The selected model's stored hyperparameters are available in best_hyperparameters.json.

Selected-model configuration:

{
  "ag_args_ensemble": {
    "save_bag_folds": true
  }
}

If the selected model is a weighted ensemble, the model archive contains the fitted component models and learned ensemble configuration.

Final Test Results

The selected model was evaluated once on 6 held-out original products.

Classification metrics are unitless proportions between 0 and 1.

Metric AutoGluon model Majority baseline
Accuracy 0.6667 0.5000
Balanced accuracy 0.6667 0.5000
Precision 0.6667 0.0000
Recall 0.6667 0.0000
F1 score 0.6667 0.0000

Accuracy difference from the majority baseline:

+0.1667

Confusion Matrix

Rows represent actual classes and columns represent predicted classes.

Actual / Predicted Standard-priced Premium-priced
Standard-priced 2 1
Premium-priced 1 2
  • True negatives: 2
  • False positives: 1
  • False negatives: 1
  • True positives: 2

Detailed row-level predictions are available in test_predictions.csv.

Uncertainty

The test set contains only 6 independent products.

The 95% Wilson confidence interval for test accuracy is:

[0.3000, 0.9032]

One test prediction changes accuracy by approximately 16.7 percentage points.

The confidence interval is wide because the independent test set is small. These point estimates should be interpreted as preliminary coursework results rather than precise estimates of real-world performance.

Model Artifact

The complete native AutoGluon predictor is stored in:

coffee_autogluon_predictor.zip

The archive contains the fitted predictor, preprocessing metadata, candidate models, selected model, and ensemble information.

Loading the Model

Install the required AutoGluon version:

%pip install "autogluon.tabular==1.6.1"

Download and extract coffee_autogluon_predictor.zip. Then load the extracted directory:

from autogluon.tabular import TabularPredictor

predictor = TabularPredictor.load(
    "path/to/extracted_predictor"
)

predictions = predictor.predict(
    new_data
)

The input DataFrame must contain:

  • origin
  • altitude_masl
  • altitude_stated
  • processing
  • roast_level
  • weight_g
  • grind

Included Files

File Contents
coffee_autogluon_predictor.zip Native trained AutoGluon predictor
leaderboard.csv Candidate validation results
test_metrics.csv Final test metrics
baseline_comparison.csv Model and baseline comparison
test_predictions.csv Row-level test predictions
best_hyperparameters.json Selected-model configuration
all_model_hyperparameters.json All stored model configurations
requirements.txt Package requirements
README.md Model Card

Limitations

  1. The dataset contains only 34 independently collected products.
  2. The test split contains only 6 products.
  3. One prediction changes test accuracy by approximately 16.7 percentage points.
  4. Augmented rows do not replace independently collected products.
  5. The premium label is relative to this dataset's median price per ounce.
  6. Prices represent a limited September 2026 retail snapshot.
  7. Prices can change across stores, regions, and time.
  8. The sample does not represent all coffee products or markets.
  9. Package characteristics may represent marketing choices rather than product quality.
  10. Strong performance on six test products would not establish broad generalization.

Known Failure Modes

The model may perform poorly on:

  • Product types absent from the source sample
  • Package weights outside the observed range
  • Uncommon origins or processing methods
  • Products close to the premium-price threshold
  • Missing or incorrectly entered package information
  • Products from different markets or time periods

Ethical Considerations

The dataset describes retail products and contains no personal or sensitive human information.

Predictions must not be interpreted as objective measures of:

  • Coffee quality
  • Taste
  • Agricultural practices
  • Producer performance
  • Worker conditions
  • Geographic quality

The model should not be used to make unsupported claims about brands, products, producers, or origins.

License

The source dataset is released under the MIT License.

This model repository is also released under the MIT License for educational and coursework use.

Hardware and Compute Budget

  • Environment: Google Colab
  • Accelerator: CPU
  • Logical CPUs reported: 2
  • Maximum AutoML training budget: 300 seconds
  • Preset: medium_quality
  • Bagging folds: 0
  • Stacking levels: 0

Package installation, data download, evaluation, compression, and upload time were not included in the 300-second training budget.

Reproducibility

Reproducibility information includes:

  • Fixed notebook seed: 24679
  • AutoGluon Tabular version 1.6.1
  • Datasets version 5.0.1
  • Published source splits
  • Saved validation leaderboard
  • Saved hyperparameter configurations
  • Saved test predictions
  • Native predictor archive
  • Explicit leakage checks

Some underlying model implementations may still produce small numerical differences across hardware or library builds.

AI Usage Disclosure

Generative AI tools were used to assist with drafting, organizing, and debugging portions of the notebook code and documentation.

The reported metrics were produced by executing the notebook and were not generated or estimated by the AI tool.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train cannj/2026-24679-coffee-autogluon-classifier