text_html_output_4.png text_html_output_2.png text_html_output_1.png text_html_output_3.png
from sklearn.linear_model import LogisticRegression

from sklearn.model_selection import train_test_split

from sklearn.pipeline import Pipeline

from sklearn.preprocessing import LabelEncoder

from sklearn.preprocessing import StandardScaler

import pandas as pd

df_iris = pd.DataFrame(pd.read_csv('/kaggle/input/iris/Iris.csv'))

df_iris.groupby('Species').size()

X = df_iris.iloc[:, 1:5]
y = pd.DataFrame(df_iris.iloc[:, 5])
le = LabelEncoder()
y['Species'] = le.fit_transform(y['Species'])
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4, random_state=0)

model = Pipeline([('scaler', StandardScaler()), ('classifier', LogisticRegression())])

model.fit(X_train, y_train)