Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
pipeline_tag: tabular-classification
|
| 6 |
+
tags:
|
| 7 |
+
- sklearn
|
| 8 |
+
- classification
|
| 9 |
+
- iris
|
| 10 |
+
- tabular
|
| 11 |
+
datasets:
|
| 12 |
+
- brjapon/iris
|
| 13 |
+
metrics:
|
| 14 |
+
- accuracy
|
| 15 |
+
library_name: scikit-learn
|
| 16 |
+
new_version: "v1.0"
|
| 17 |
+
model-index:
|
| 18 |
+
- name: Iris Decision Tree
|
| 19 |
+
results:
|
| 20 |
+
- task:
|
| 21 |
+
type: tabular-classification
|
| 22 |
+
name: Classification
|
| 23 |
+
metrics:
|
| 24 |
+
- type: accuracy
|
| 25 |
+
value: 0.97
|
| 26 |
+
name: Test Accuracy
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
# Iris Classification Models
|
| 30 |
+
|
| 31 |
+
This repository starts with a **Decision Tree** model trained on the classic **Iris dataset**. The model classifies iris flowers into three species—*setosa*, *versicolor*, or *virginica*—based on four numeric features (sepal length, sepal width, petal length, and petal width).
|
| 32 |
+
|
| 33 |
+
Because of its small size and simplicity, this model is intended primarily for **demonstration and educational** purposes.
|
| 34 |
+
|
| 35 |
+
## Model Description
|
| 36 |
+
- **Framework**: [Scikit-Learn](https://scikit-learn.org/stable/)
|
| 37 |
+
- **Algorithm**: Decision Tree (`DecisionTreeClassifier` class)
|
| 38 |
+
- **Hyperparameters**:
|
| 39 |
+
- Defaults for Decision Tree in Scikit-Learn
|
| 40 |
+
|
| 41 |
+
### Intended Uses
|
| 42 |
+
- **Education/Proof-of-Concept**: Demonstrates loading a scikit-learn model from the Hugging Face Hub.
|
| 43 |
+
- **Beginner ML Tutorials**: Introduction to classification tasks, usage of Hugging Face model hosting, and deploying simple demos in Spaces.
|
| 44 |
+
|
| 45 |
+
### Limitations
|
| 46 |
+
- **Dataset Size**: The Iris dataset is small (150 samples). Performance metrics may not extrapolate to real-world scenarios.
|
| 47 |
+
- **Domain Constraints**: The dataset only covers three iris species and may not generalize to other types of flowers.
|
| 48 |
+
- **Not Production-Ready**: This model is not suited for critical applications (e.g., healthcare, autonomous vehicles).
|
| 49 |
+
|
| 50 |
+
## How to Use
|
| 51 |
+
To use this model, you can load the `.joblib` file from the Hub in Python code:
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import joblib
|
| 55 |
+
from huggingface_hub import hf_hub_download
|
| 56 |
+
|
| 57 |
+
# Accompanying dataset is hosted in Hugging Face under 'Jesus02/iris-clase'
|
| 58 |
+
model_path = hf_hub_download(repo_id="brjapon/iris",
|
| 59 |
+
filename="iris_dt.joblib",
|
| 60 |
+
repo_type="model")
|
| 61 |
+
|
| 62 |
+
model = joblib.load(model_path)
|
| 63 |
+
|
| 64 |
+
# Example prediction (random values below)
|
| 65 |
+
sample_input = [[5.1, 3.5, 1.4, 0.2]]
|
| 66 |
+
prediction = model.predict(sample_input)
|
| 67 |
+
print(prediction) # e.g., [0] which might correspond to 'setosa'
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Training Procedure
|
| 71 |
+
- **Training Data**: 80% of the 150-sample Iris dataset (120 samples).
|
| 72 |
+
- **Validation Data**: 20% (30 samples).
|
| 73 |
+
- **Steps**:
|
| 74 |
+
1. Loaded dataset (obtained from HF repository `brjapon/iris`)
|
| 75 |
+
2. Split into training and test sets with `train_test_split`
|
| 76 |
+
3. Trained Decision Tree model with default settings
|
| 77 |
+
4. Evaluated accuracy on the test set
|
| 78 |
+
|
| 79 |
+
## Performance
|
| 80 |
+
Using a random 80/20 split, the model typically achieves **~97%** accuracy on the test subset. Actual results may vary depending on your specific train/test split random state.
|
| 81 |
+
|
| 82 |
+
## Limitations & Bias
|
| 83 |
+
- The Iris dataset is not representative of modern, large-scale classification tasks.
|
| 84 |
+
- Results should not be generalized beyond the included species and scenario.
|