File size: 2,272 Bytes
f84b46f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
---
title: Iris Flower Classification
emoji: 🌸
colorFrom: blue
colorTo: purple
sdk: docker
sdk_version: "4.36.2"
app_file: app.py
pinned: false
license: mit
---

# 🌸 Iris Flower Classification API

Aplikasi Machine Learning untuk klasifikasi bunga Iris menggunakan Decision Tree Algorithm. API ini dapat memprediksi spesies bunga Iris (Setosa, Versicolor, atau Virginica) berdasarkan fitur morfologi bunga.

## πŸ“Š Dataset & Model

- **Dataset**: Iris Dataset dari scikit-learn
- **Algorithm**: Decision Tree Classifier
- **Features**: 
  - Sepal Length (cm)
  - Sepal Width (cm) 
  - Petal Length (cm)
  - Petal Width (cm)
- **Target Classes**: Setosa, Versicolor, Virginica

## πŸš€ API Endpoints

### 1. Home Page
```
GET /
```
Web interface interaktif untuk testing model

### 2. Predict Species
```
POST /predict
Content-Type: application/json

{
  "sepal_length": 5.1,
  "sepal_width": 3.5,
  "petal_length": 1.4,
  "petal_width": 0.2
}
```

### 3. Model Information
```
GET /model-info
```
Informasi detail tentang model dan feature importance

### 4. Health Check
```
GET /health
```
Status kesehatan API

## πŸ§ͺ Example Usage

### Prediksi Setosa:
```json
{
  "sepal_length": 5.1,
  "sepal_width": 3.5,
  "petal_length": 1.4,
  "petal_width": 0.2
}
```

### Prediksi Versicolor:
```json
{
  "sepal_length": 7.0,
  "sepal_width": 3.2,
  "petal_length": 4.7,
  "petal_width": 1.4
}
```

### Prediksi Virginica:
```json
{
  "sepal_length": 6.3,
  "sepal_width": 3.3,
  "petal_length": 6.0,
  "petal_width": 2.5
}
```

## πŸ“ˆ Model Performance

- **Accuracy**: 100% (pada test set)
- **Algorithm**: Decision Tree dengan random_state=42
- **Training Data**: 120 samples
- **Test Data**: 30 samples

## πŸ”— Key Decision Rules

Berdasarkan Decision Tree yang dihasilkan:

1. **Setosa**: Petal Length ≀ 2.45 cm
2. **Versicolor**: Petal Length > 2.45 cm AND Petal Width ≀ 1.75 cm
3. **Virginica**: Petal Length > 2.45 cm AND Petal Width > 1.75 cm

## πŸ› οΈ Technology Stack

- **Backend**: Flask + Python 3.11
- **ML**: scikit-learn, pandas, numpy
- **Model Persistence**: joblib
- **Container**: Docker
- **Deployment**: Hugging Face Spaces

## πŸ‘¨β€πŸ’» Author

Tugas 27 - Machine Learning Model Deployment
**Universitas/Institusi**: Infinite Learning