login / main.py
kuldeep0204's picture
Rename app.py to main.py
da93f27 verified
raw
history blame contribute delete
486 Bytes
import seaborn as sns
from sklearn.linear_model import LogisticRegression
# Load iris dataset
iris = sns.load_dataset("iris")
# Prepare features and labels
X = iris.iloc[:, 0:4].values
y = iris.iloc[:, 4].values
# Train logistic regression
modlog = LogisticRegression(max_iter=300)
modlog.fit(X, y)
# Example flower measurements (setosa)
sl = 5.1
sw = 3.5
pl = 1.4
pw = 0.2
# Predict
res = modlog.predict([[sl, sw, pl, pw]])
print("The predicted flower species is " + str(res[0]))