--- 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