Cheese Texture Classification Model
Model Description
This is an AutoGluon-trained machine learning model for predicting cheese texture based on nutritional and origin features. The model was trained using automated machine learning techniques to find the best performing algorithm and hyperparameters for this classification task.
Model Creator: Rumi Loghmani
Model Repository: rlogh/cheese-texture-autogluon-classifier
Model Details
- Model Type: AutoGluon TabularPredictor
- Task: Multiclass Classification
- Target Variable: texture (soft, semi-soft, semi-hard, hard)
- Features: fat, origin, holed, price, protein
- Best Model: NeuralNetTorch_r121_BAG_L1
- Training Time: 9.27 seconds
- Prediction Time: 0.0627 seconds per sample
Dataset
- Source: aslan-ng/cheese-tabular
- Original Dataset Creator: Aslan Noorghasemi (Hugging Face username: aslan-ng)
- Training Data: 300 augmented samples (80% train, 20% test)
- Validation Data: 30 original samples
- Total Features: 5 (fat, origin, holed, price, protein)
- Classes: 4 texture categories
Performance
Test Set Performance (Synthetic Data)
- Accuracy: 0.3167
- Weighted F1 Score: 0.3100
External Validation (Original Data)
- Accuracy: 0.1667
- Weighted F1 Score: 0.1635
Usage
Quick Inference (Pickle File)
import cloudpickle
import huggingface_hub
import pandas as pd
# Download and load the model
model_path = huggingface_hub.hf_hub_download(
repo_id="rlogh/cheese-texture-autogluon-classifier",
filename="cheese_texture_predictor.pkl"
)
with open(model_path, "rb") as f:
predictor = cloudpickle.load(f)
# Prepare your data (example)
new_cheese_data = pd.DataFrame({
'fat': [25.0],
'origin': ['Italy'],
'holed': [0],
'price': [3.50],
'protein': [22.0]
})
# Make predictions
predictions = predictor.predict(new_cheese_data)
print(f"Predicted texture: {predictions[0]}")
Complete Inference (Native Directory)
import huggingface_hub
import zipfile
import shutil
import autogluon.tabular
import pandas as pd
# Download and extract the model
zip_path = huggingface_hub.hf_hub_download(
repo_id="rlogh/cheese-texture-autogluon-classifier",
filename="cheese_texture_predictor_dir.zip"
)
# Extract to a directory
extract_dir = "extracted_predictor"
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
zip_ref.extractall(extract_dir)
# Load the native predictor
predictor = autogluon.tabular.TabularPredictor.load(extract_dir)
# Make predictions
predictions = predictor.predict(new_cheese_data)
Feature Importance
The model considers the following features in order of importance:
- fat: Fat content per 100g of cheese
- protein: Protein content per 100g of cheese
- price: Price per unit
- origin: Country/region of origin
- holed: Whether the cheese has holes (0 or 1)
Limitations
- The model is trained on a relatively small dataset (330 samples total)
- Performance may vary on cheese types not well represented in the training data
- The model assumes standard nutritional values and may not account for variations in cheese production methods
- External validation shows some performance degradation, indicating potential overfitting to synthetic data
Training Details
- Framework: AutoGluon Tabular
- Training Time: 10 minutes (600 seconds)
- Preset: best_quality
- Evaluation Metric: accuracy
- Cross-Validation: Yes (handled by AutoGluon)
AI Usage in Development
This code was developed with the assistance of an AI co-pilot. The AI helped with various tasks, including:
- Generating initial code structures and boilerplate.
- Providing suggestions for code optimization and best practices.
- Assisting with debugging and error resolution.
- Generating explanatory text and documentation, such as parts of this model card.
The AI acted as a collaborative partner throughout the development process, accelerating the coding workflow and providing helpful guidance.
Citation
If you use this model, please cite the original dataset:
@dataset{aslan-ng/cheese-tabular,
title={Cheese Tabular Dataset},
author={Aslan Noorghasemi},
year={2024},
url={https://huggingface.co/datasets/aslan-ng/cheese-tabular},
publisher={Hugging Face},
doi={10.57967/hf/1234}
}
Original Dataset: aslan-ng/cheese-tabular
Dataset Creator: Aslan Noorghasemi (@aslan-ng)
Contact
Model Creator: Rumi Loghmani
Model Questions: Please refer to the model repository or contact the model creator.
Dataset Questions: For questions about the original dataset, please contact Aslan Noorghasemi or refer to the original dataset documentation.
Dataset used to train rlogh/cheese-texture-autogluon-classifier
Spaces using rlogh/cheese-texture-autogluon-classifier 2
Evaluation results
- Test Accuracy on Cheese Tabular Datasetself-reported0.317
- Test F1 Score on Cheese Tabular Datasetself-reported0.310
- External Validation Accuracy on Cheese Tabular Datasetself-reported0.167
- External Validation F1 Score on Cheese Tabular Datasetself-reported0.164