Update README.md
Browse files
README.md
CHANGED
|
@@ -1,184 +1,196 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
tags:
|
| 4 |
-
- tabular
|
| 5 |
-
- classification
|
| 6 |
-
- automl
|
| 7 |
-
- autogluon
|
| 8 |
-
- cheese
|
| 9 |
-
- food
|
| 10 |
-
- texture
|
| 11 |
-
datasets:
|
| 12 |
-
- aslan-ng/cheese-tabular
|
| 13 |
-
metrics:
|
| 14 |
-
- accuracy
|
| 15 |
-
- f1-score
|
| 16 |
-
model-index:
|
| 17 |
-
- name: Cheese Texture AutoGluon Classifier
|
| 18 |
-
results:
|
| 19 |
-
- task:
|
| 20 |
-
type: text-classification
|
| 21 |
-
name: Cheese Texture Classification
|
| 22 |
-
dataset:
|
| 23 |
-
type: aslan-ng/cheese-tabular
|
| 24 |
-
name: Cheese Tabular Dataset
|
| 25 |
-
metrics:
|
| 26 |
-
- type: accuracy
|
| 27 |
-
value: 0.3167
|
| 28 |
-
name: Test Accuracy
|
| 29 |
-
- type: f1
|
| 30 |
-
value: 0.3100
|
| 31 |
-
name: Test F1 Score
|
| 32 |
-
- type: accuracy
|
| 33 |
-
value: 0.1667
|
| 34 |
-
name: External Validation Accuracy
|
| 35 |
-
- type: f1
|
| 36 |
-
value: 0.1635
|
| 37 |
-
name: External Validation F1 Score
|
| 38 |
-
---
|
| 39 |
-
|
| 40 |
-
# Cheese Texture Classification Model
|
| 41 |
-
|
| 42 |
-
## Model Description
|
| 43 |
-
|
| 44 |
-
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.
|
| 45 |
-
|
| 46 |
-
**Model Creator**: Rumi Loghmani
|
| 47 |
-
**Model Repository**: [rlogh/cheese-texture-autogluon-classifier](https://huggingface.co/rlogh/cheese-texture-autogluon-classifier)
|
| 48 |
-
|
| 49 |
-
## Model Details
|
| 50 |
-
|
| 51 |
-
- **Model Type**: AutoGluon TabularPredictor
|
| 52 |
-
- **Task**: Multiclass Classification
|
| 53 |
-
- **Target Variable**: texture (soft, semi-soft, semi-hard, hard)
|
| 54 |
-
- **Features**: fat, origin, holed, price, protein
|
| 55 |
-
- **Best Model**: NeuralNetTorch_r121_BAG_L1
|
| 56 |
-
- **Training Time**: 9.27 seconds
|
| 57 |
-
- **Prediction Time**: 0.0627 seconds per sample
|
| 58 |
-
|
| 59 |
-
## Dataset
|
| 60 |
-
|
| 61 |
-
- **Source**: [aslan-ng/cheese-tabular](https://huggingface.co/datasets/aslan-ng/cheese-tabular)
|
| 62 |
-
- **Original Dataset Creator**: [Aslan Noorghasemi](https://huggingface.co/aslan-ng) (Hugging Face username: aslan-ng)
|
| 63 |
-
- **Training Data**: 300 augmented samples (80% train, 20% test)
|
| 64 |
-
- **Validation Data**: 30 original samples
|
| 65 |
-
- **Total Features**: 5 (fat, origin, holed, price, protein)
|
| 66 |
-
- **Classes**: 4 texture categories
|
| 67 |
-
|
| 68 |
-
## Performance
|
| 69 |
-
|
| 70 |
-
### Test Set Performance (Synthetic Data)
|
| 71 |
-
- **Accuracy**: 0.3167
|
| 72 |
-
- **Weighted F1 Score**: 0.3100
|
| 73 |
-
|
| 74 |
-
### External Validation (Original Data)
|
| 75 |
-
- **Accuracy**: 0.1667
|
| 76 |
-
- **Weighted F1 Score**: 0.1635
|
| 77 |
-
|
| 78 |
-
## Usage
|
| 79 |
-
|
| 80 |
-
### Quick Inference (Pickle File)
|
| 81 |
-
|
| 82 |
-
```python
|
| 83 |
-
import cloudpickle
|
| 84 |
-
import huggingface_hub
|
| 85 |
-
import pandas as pd
|
| 86 |
-
|
| 87 |
-
# Download and load the model
|
| 88 |
-
model_path = huggingface_hub.hf_hub_download(
|
| 89 |
-
repo_id="rlogh/cheese-texture-autogluon-classifier",
|
| 90 |
-
filename="cheese_texture_predictor.pkl"
|
| 91 |
-
)
|
| 92 |
-
|
| 93 |
-
with open(model_path, "rb") as f:
|
| 94 |
-
predictor = cloudpickle.load(f)
|
| 95 |
-
|
| 96 |
-
# Prepare your data (example)
|
| 97 |
-
new_cheese_data = pd.DataFrame({
|
| 98 |
-
'fat': [25.0],
|
| 99 |
-
'origin': ['Italy'],
|
| 100 |
-
'holed': [0],
|
| 101 |
-
'price': [3.50],
|
| 102 |
-
'protein': [22.0]
|
| 103 |
-
})
|
| 104 |
-
|
| 105 |
-
# Make predictions
|
| 106 |
-
predictions = predictor.predict(new_cheese_data)
|
| 107 |
-
print(f"Predicted texture: {predictions[0]}")
|
| 108 |
-
```
|
| 109 |
-
|
| 110 |
-
### Complete Inference (Native Directory)
|
| 111 |
-
|
| 112 |
-
```python
|
| 113 |
-
import huggingface_hub
|
| 114 |
-
import zipfile
|
| 115 |
-
import shutil
|
| 116 |
-
import autogluon.tabular
|
| 117 |
-
import pandas as pd
|
| 118 |
-
|
| 119 |
-
# Download and extract the model
|
| 120 |
-
zip_path = huggingface_hub.hf_hub_download(
|
| 121 |
-
repo_id="rlogh/cheese-texture-autogluon-classifier",
|
| 122 |
-
filename="cheese_texture_predictor_dir.zip"
|
| 123 |
-
)
|
| 124 |
-
|
| 125 |
-
# Extract to a directory
|
| 126 |
-
extract_dir = "extracted_predictor"
|
| 127 |
-
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
| 128 |
-
zip_ref.extractall(extract_dir)
|
| 129 |
-
|
| 130 |
-
# Load the native predictor
|
| 131 |
-
predictor = autogluon.tabular.TabularPredictor.load(extract_dir)
|
| 132 |
-
|
| 133 |
-
# Make predictions
|
| 134 |
-
predictions = predictor.predict(new_cheese_data)
|
| 135 |
-
```
|
| 136 |
-
|
| 137 |
-
## Feature Importance
|
| 138 |
-
|
| 139 |
-
The model considers the following features in order of importance:
|
| 140 |
-
1. **fat**: Fat content per 100g of cheese
|
| 141 |
-
2. **protein**: Protein content per 100g of cheese
|
| 142 |
-
3. **price**: Price per unit
|
| 143 |
-
4. **origin**: Country/region of origin
|
| 144 |
-
5. **holed**: Whether the cheese has holes (0 or 1)
|
| 145 |
-
|
| 146 |
-
## Limitations
|
| 147 |
-
|
| 148 |
-
- The model is trained on a relatively small dataset (330 samples total)
|
| 149 |
-
- Performance may vary on cheese types not well represented in the training data
|
| 150 |
-
- The model assumes standard nutritional values and may not account for variations in cheese production methods
|
| 151 |
-
- External validation shows some performance degradation, indicating potential overfitting to synthetic data
|
| 152 |
-
|
| 153 |
-
## Training Details
|
| 154 |
-
|
| 155 |
-
- **Framework**: AutoGluon Tabular
|
| 156 |
-
- **Training Time**: 10 minutes (600 seconds)
|
| 157 |
-
- **Preset**: best_quality
|
| 158 |
-
- **Evaluation Metric**: accuracy
|
| 159 |
-
- **Cross-Validation**: Yes (handled by AutoGluon)
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- tabular
|
| 5 |
+
- classification
|
| 6 |
+
- automl
|
| 7 |
+
- autogluon
|
| 8 |
+
- cheese
|
| 9 |
+
- food
|
| 10 |
+
- texture
|
| 11 |
+
datasets:
|
| 12 |
+
- aslan-ng/cheese-tabular
|
| 13 |
+
metrics:
|
| 14 |
+
- accuracy
|
| 15 |
+
- f1-score
|
| 16 |
+
model-index:
|
| 17 |
+
- name: Cheese Texture AutoGluon Classifier
|
| 18 |
+
results:
|
| 19 |
+
- task:
|
| 20 |
+
type: text-classification
|
| 21 |
+
name: Cheese Texture Classification
|
| 22 |
+
dataset:
|
| 23 |
+
type: aslan-ng/cheese-tabular
|
| 24 |
+
name: Cheese Tabular Dataset
|
| 25 |
+
metrics:
|
| 26 |
+
- type: accuracy
|
| 27 |
+
value: 0.3167
|
| 28 |
+
name: Test Accuracy
|
| 29 |
+
- type: f1
|
| 30 |
+
value: 0.3100
|
| 31 |
+
name: Test F1 Score
|
| 32 |
+
- type: accuracy
|
| 33 |
+
value: 0.1667
|
| 34 |
+
name: External Validation Accuracy
|
| 35 |
+
- type: f1
|
| 36 |
+
value: 0.1635
|
| 37 |
+
name: External Validation F1 Score
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
# Cheese Texture Classification Model
|
| 41 |
+
|
| 42 |
+
## Model Description
|
| 43 |
+
|
| 44 |
+
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.
|
| 45 |
+
|
| 46 |
+
**Model Creator**: Rumi Loghmani
|
| 47 |
+
**Model Repository**: [rlogh/cheese-texture-autogluon-classifier](https://huggingface.co/rlogh/cheese-texture-autogluon-classifier)
|
| 48 |
+
|
| 49 |
+
## Model Details
|
| 50 |
+
|
| 51 |
+
- **Model Type**: AutoGluon TabularPredictor
|
| 52 |
+
- **Task**: Multiclass Classification
|
| 53 |
+
- **Target Variable**: texture (soft, semi-soft, semi-hard, hard)
|
| 54 |
+
- **Features**: fat, origin, holed, price, protein
|
| 55 |
+
- **Best Model**: NeuralNetTorch_r121_BAG_L1
|
| 56 |
+
- **Training Time**: 9.27 seconds
|
| 57 |
+
- **Prediction Time**: 0.0627 seconds per sample
|
| 58 |
+
|
| 59 |
+
## Dataset
|
| 60 |
+
|
| 61 |
+
- **Source**: [aslan-ng/cheese-tabular](https://huggingface.co/datasets/aslan-ng/cheese-tabular)
|
| 62 |
+
- **Original Dataset Creator**: [Aslan Noorghasemi](https://huggingface.co/aslan-ng) (Hugging Face username: aslan-ng)
|
| 63 |
+
- **Training Data**: 300 augmented samples (80% train, 20% test)
|
| 64 |
+
- **Validation Data**: 30 original samples
|
| 65 |
+
- **Total Features**: 5 (fat, origin, holed, price, protein)
|
| 66 |
+
- **Classes**: 4 texture categories
|
| 67 |
+
|
| 68 |
+
## Performance
|
| 69 |
+
|
| 70 |
+
### Test Set Performance (Synthetic Data)
|
| 71 |
+
- **Accuracy**: 0.3167
|
| 72 |
+
- **Weighted F1 Score**: 0.3100
|
| 73 |
+
|
| 74 |
+
### External Validation (Original Data)
|
| 75 |
+
- **Accuracy**: 0.1667
|
| 76 |
+
- **Weighted F1 Score**: 0.1635
|
| 77 |
+
|
| 78 |
+
## Usage
|
| 79 |
+
|
| 80 |
+
### Quick Inference (Pickle File)
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
import cloudpickle
|
| 84 |
+
import huggingface_hub
|
| 85 |
+
import pandas as pd
|
| 86 |
+
|
| 87 |
+
# Download and load the model
|
| 88 |
+
model_path = huggingface_hub.hf_hub_download(
|
| 89 |
+
repo_id="rlogh/cheese-texture-autogluon-classifier",
|
| 90 |
+
filename="cheese_texture_predictor.pkl"
|
| 91 |
+
)
|
| 92 |
+
|
| 93 |
+
with open(model_path, "rb") as f:
|
| 94 |
+
predictor = cloudpickle.load(f)
|
| 95 |
+
|
| 96 |
+
# Prepare your data (example)
|
| 97 |
+
new_cheese_data = pd.DataFrame({
|
| 98 |
+
'fat': [25.0],
|
| 99 |
+
'origin': ['Italy'],
|
| 100 |
+
'holed': [0],
|
| 101 |
+
'price': [3.50],
|
| 102 |
+
'protein': [22.0]
|
| 103 |
+
})
|
| 104 |
+
|
| 105 |
+
# Make predictions
|
| 106 |
+
predictions = predictor.predict(new_cheese_data)
|
| 107 |
+
print(f"Predicted texture: {predictions[0]}")
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
### Complete Inference (Native Directory)
|
| 111 |
+
|
| 112 |
+
```python
|
| 113 |
+
import huggingface_hub
|
| 114 |
+
import zipfile
|
| 115 |
+
import shutil
|
| 116 |
+
import autogluon.tabular
|
| 117 |
+
import pandas as pd
|
| 118 |
+
|
| 119 |
+
# Download and extract the model
|
| 120 |
+
zip_path = huggingface_hub.hf_hub_download(
|
| 121 |
+
repo_id="rlogh/cheese-texture-autogluon-classifier",
|
| 122 |
+
filename="cheese_texture_predictor_dir.zip"
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
# Extract to a directory
|
| 126 |
+
extract_dir = "extracted_predictor"
|
| 127 |
+
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
|
| 128 |
+
zip_ref.extractall(extract_dir)
|
| 129 |
+
|
| 130 |
+
# Load the native predictor
|
| 131 |
+
predictor = autogluon.tabular.TabularPredictor.load(extract_dir)
|
| 132 |
+
|
| 133 |
+
# Make predictions
|
| 134 |
+
predictions = predictor.predict(new_cheese_data)
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
## Feature Importance
|
| 138 |
+
|
| 139 |
+
The model considers the following features in order of importance:
|
| 140 |
+
1. **fat**: Fat content per 100g of cheese
|
| 141 |
+
2. **protein**: Protein content per 100g of cheese
|
| 142 |
+
3. **price**: Price per unit
|
| 143 |
+
4. **origin**: Country/region of origin
|
| 144 |
+
5. **holed**: Whether the cheese has holes (0 or 1)
|
| 145 |
+
|
| 146 |
+
## Limitations
|
| 147 |
+
|
| 148 |
+
- The model is trained on a relatively small dataset (330 samples total)
|
| 149 |
+
- Performance may vary on cheese types not well represented in the training data
|
| 150 |
+
- The model assumes standard nutritional values and may not account for variations in cheese production methods
|
| 151 |
+
- External validation shows some performance degradation, indicating potential overfitting to synthetic data
|
| 152 |
+
|
| 153 |
+
## Training Details
|
| 154 |
+
|
| 155 |
+
- **Framework**: AutoGluon Tabular
|
| 156 |
+
- **Training Time**: 10 minutes (600 seconds)
|
| 157 |
+
- **Preset**: best_quality
|
| 158 |
+
- **Evaluation Metric**: accuracy
|
| 159 |
+
- **Cross-Validation**: Yes (handled by AutoGluon)
|
| 160 |
+
|
| 161 |
+
|
| 162 |
+
## AI Usage in Development
|
| 163 |
+
|
| 164 |
+
This code was developed with the assistance of an AI co-pilot. The AI helped with various tasks, including:
|
| 165 |
+
- Generating initial code structures and boilerplate.
|
| 166 |
+
- Providing suggestions for code optimization and best practices.
|
| 167 |
+
- Assisting with debugging and error resolution.
|
| 168 |
+
- Generating explanatory text and documentation, such as parts of this model card.
|
| 169 |
+
|
| 170 |
+
The AI acted as a collaborative partner throughout the development process, accelerating the coding workflow and providing helpful guidance.
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
## Citation
|
| 174 |
+
|
| 175 |
+
If you use this model, please cite the original dataset:
|
| 176 |
+
|
| 177 |
+
```bibtex
|
| 178 |
+
@dataset{aslan-ng/cheese-tabular,
|
| 179 |
+
title={Cheese Tabular Dataset},
|
| 180 |
+
author={Aslan Noorghasemi},
|
| 181 |
+
year={2024},
|
| 182 |
+
url={https://huggingface.co/datasets/aslan-ng/cheese-tabular},
|
| 183 |
+
publisher={Hugging Face},
|
| 184 |
+
doi={10.57967/hf/1234}
|
| 185 |
+
}
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
**Original Dataset**: [aslan-ng/cheese-tabular](https://huggingface.co/datasets/aslan-ng/cheese-tabular)
|
| 189 |
+
**Dataset Creator**: [Aslan Noorghasemi](https://huggingface.co/aslan-ng) (@aslan-ng)
|
| 190 |
+
|
| 191 |
+
## Contact
|
| 192 |
+
|
| 193 |
+
**Model Creator**: Rumi Loghmani
|
| 194 |
+
**Model Questions**: Please refer to the model repository or contact the model creator.
|
| 195 |
+
|
| 196 |
+
**Dataset Questions**: For questions about the original dataset, please contact [Aslan Noorghasemi](https://huggingface.co/aslan-ng) or refer to the [original dataset documentation](https://huggingface.co/datasets/aslan-ng/cheese-tabular).
|