--- license: mit language: - en --- 🌸 Iris Flower Species Predictor 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: - Sepal length (cm) - Sepal width (cm) - Petal length (cm) - Petal width (cm) The model is built using a **Decision Tree Classifier** from **scikit-learn**, trained on the classic Iris dataset. --- Model Overview - **Algorithm:** Decision Tree Classifier - **Library:** Scikit-learn - **Dataset:** `sklearn.datasets.load_iris()` - **Accuracy:** ~95% (on test data using 70/30 split) --- How to Use Input You need to provide these four numerical inputs: | Feature | Type | Example | |----------------|--------|---------| | Sepal length | Float | 5.1 | | Sepal width | Float | 3.5 | | Petal length | Float | 1.4 | | Petal width | Float | 0.2 | Output The model returns the predicted **species** as one of the following: - `setosa` - `versicolor` - `virginica` --- Example Code ```python from sklearn.datasets import load_iris from sklearn.tree import DecisionTreeClassifier # Load and train model iris = load_iris() X, y = iris.data, iris.target model = DecisionTreeClassifier() model.fit(X, y) # Predict sample = [[5.1, 3.5, 1.4, 0.2]] predicted_class = model.predict(sample)[0] print("Predicted species:", iris.target_names[predicted_class])