Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: mit
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
---
|
| 6 |
+
🌸 Iris Flower Species Predictor
|
| 7 |
+
|
| 8 |
+
This is a simple yet effective machine learning model that predicts the species of an Iris flower (`setosa`, `versicolor`, or `virginica`) using four key features:
|
| 9 |
+
|
| 10 |
+
- Sepal length (cm)
|
| 11 |
+
- Sepal width (cm)
|
| 12 |
+
- Petal length (cm)
|
| 13 |
+
- Petal width (cm)
|
| 14 |
+
|
| 15 |
+
The model is built using a **Decision Tree Classifier** from **scikit-learn**, trained on the classic Iris dataset.
|
| 16 |
+
|
| 17 |
+
---
|
| 18 |
+
|
| 19 |
+
Model Overview
|
| 20 |
+
|
| 21 |
+
- **Algorithm:** Decision Tree Classifier
|
| 22 |
+
- **Library:** Scikit-learn
|
| 23 |
+
- **Dataset:** `sklearn.datasets.load_iris()`
|
| 24 |
+
- **Accuracy:** ~95% (on test data using 70/30 split)
|
| 25 |
+
|
| 26 |
+
---
|
| 27 |
+
|
| 28 |
+
How to Use
|
| 29 |
+
|
| 30 |
+
Input
|
| 31 |
+
|
| 32 |
+
You need to provide these four numerical inputs:
|
| 33 |
+
|
| 34 |
+
| Feature | Type | Example |
|
| 35 |
+
|----------------|--------|---------|
|
| 36 |
+
| Sepal length | Float | 5.1 |
|
| 37 |
+
| Sepal width | Float | 3.5 |
|
| 38 |
+
| Petal length | Float | 1.4 |
|
| 39 |
+
| Petal width | Float | 0.2 |
|
| 40 |
+
|
| 41 |
+
Output
|
| 42 |
+
|
| 43 |
+
The model returns the predicted **species** as one of the following:
|
| 44 |
+
- `setosa`
|
| 45 |
+
- `versicolor`
|
| 46 |
+
- `virginica`
|
| 47 |
+
|
| 48 |
+
---
|
| 49 |
+
|
| 50 |
+
Example Code
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
from sklearn.datasets import load_iris
|
| 54 |
+
from sklearn.tree import DecisionTreeClassifier
|
| 55 |
+
|
| 56 |
+
# Load and train model
|
| 57 |
+
iris = load_iris()
|
| 58 |
+
X, y = iris.data, iris.target
|
| 59 |
+
model = DecisionTreeClassifier()
|
| 60 |
+
model.fit(X, y)
|
| 61 |
+
|
| 62 |
+
# Predict
|
| 63 |
+
sample = [[5.1, 3.5, 1.4, 0.2]]
|
| 64 |
+
predicted_class = model.predict(sample)[0]
|
| 65 |
+
print("Predicted species:", iris.target_names[predicted_class])
|