<jupyter_start><jupyter_text>Step 0: Import the libraries<jupyter_code>import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Step 1: Import the dataset<jupyter_code>iris_df = pd.read_csv('Iris.csv')
iris_df.head(5)
iris_df.tail(5)
sns.scatterplot(x = 'SepalLengthCm',y = 'SepalWidthCm', hue= 'Species',data= iris_df)
sns.scatterplot(x = 'PetalLengthCm',y = 'PetalWidthCm', hue= 'Species',data= iris_df)
plt.figure(figsize = [10,10])

plt.subplot(2, 2, 1)
sns.violinplot(x = 'Species', y= 'SepalLengthCm', data = iris_df)

plt.subplot(2, 2, 2)
sns.violinplot(x = 'Species', y= 'SepalWidthCm', data = iris_df)

plt.subplot(2, 2, 3)
sns.violinplot(x = 'Species', y= 'PetalLengthCm', data = iris_df)

plt.subplot(2, 2, 4)
sns.violinplot(x = 'Species', y= 'PetalLengthCm', data = iris_df)
sns.pairplot(iris_df, hue = 'Species')
sns.heatmap(iris_df.corr(),annot = True)<jupyter_output><empty_output><jupyter_text>Step 3: Data Cleaning<jupyter_code>X = iris_df.drop(['Species'], axis = 1)
Y = iris_df['Species']
X
Y
from sklearn.model_selection import train_test_split
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size = 0.25)<jupyter_output><empty_output><jupyter_text>Step 4: Train the model<jupyter_code>from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import classification_report, confusion_matrix
classifier = KNeighborsClassifier(n_neighbors = 5, metric = 'minkowski', p = 2)
classifier.fit(X_train, Y_train)<jupyter_output><empty_output><jupyter_text>Step 5: Evaluate the Model<jupyter_code>Y_predict = classifier.predict(X_test)
Y_predict
Y_test
cm = confusion_matrix(Y_test, Y_predict)
sns.heatmap(cm, annot = True)
print(classification_report(Y_test, Y_predict))<jupyter_output>precision    recall  f1-score   support

    Iris-setosa       1.00      1.00      1.00        13
Iris-versicolor       1.00      0.80      0.89        15
 Iris-virginica       0.77      1.00      0.87        10

    avg / total       0.94      0.92      0.92        38
{'fraction_non_alphanumeric': 0.12487945998071359, 'fraction_numerical': 0.03567984570877531, 'mean_word_length': 4.928571428571429, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '444616', 'license': 'CC0-1.0', 'n_tokens_mistral': 899, 'n_tokens_neox': 837, 'n_words': 164, 'path': 'KNN 2 - Iris Flower Classification.ipynb', 'repo_name': 'mcvenkat/Python-Programs', 'size': '2074'}