<jupyter_start><jupyter_text>Importing necessary libraries<jupyter_code>from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
from tensorflow.python.keras import utils
import numpy as np
import pandas as pd
import seaborn as sn
import missingno as msno
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split<jupyter_output><empty_output><jupyter_text>Import Data<jupyter_code>COLUMN_NAMES = [
        'SepalLength', 
        'SepalWidth',
        'PetalLength', 
        'PetalWidth', 
        'Species'
        ]

data = pd.read_csv('iris_data.csv', names=COLUMN_NAMES, header=0)
data.head()<jupyter_output><empty_output><jupyter_text>Data Analysis   Data Types Analysis<jupyter_code>data.dtypes<jupyter_output><empty_output><jupyter_text>Handle Categorical Variables<jupyter_code>data['Species'] = data['Species'].astype("category")
data.dtypes
distribution = sn.countplot(x="Species", data=data)
plt.show(distribution)<jupyter_output><empty_output><jupyter_text>Missing Information<jupyter_code>print(data.isnull().sum())<jupyter_output>SepalLength    0
SepalWidth     0
PetalLength    0
PetalWidth     0
Species        0
dtype: int64<jupyter_text>Correlation Analysis<jupyter_code>corrMatt = data[["SepalLength","SepalWidth","PetalLength","PetalWidth","Species"]].corr()
mask = np.array(corrMatt)
mask[np.tril_indices_from(mask)] = False
fig,ax= plt.subplots()
fig.set_size_inches(20,10)
sn.heatmap(corrMatt, mask=mask,vmax=.8, square=True,annot=True)<jupyter_output><empty_output><jupyter_text>Implementation  Split Data to Test and Train<jupyter_code>output_data = data["Species"]
input_data = data.drop("Species",axis=1)
X_train, X_test, y_train, y_test = train_test_split(input_data, output_data, test_size=0.3, random_state=42)

y_train = utils.to_categorical(y_train) 
y_test = utils.to_categorical(y_test)

print("Input training size: ", X_train.shape[0])
print("Output training size: ", y_train.shape[0])
print("Input testing size: ", X_test.shape[0])
print("Output testing size: ", y_test.shape[0])
X_train.head()<jupyter_output><empty_output><jupyter_text>Creating & compiling a model<jupyter_code>model = Sequential()
model.add(Dense(10, input_dim=4, activation='relu'))
model.add(Dense(10, activation='relu'))
model.add(Dense(3, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])<jupyter_output><empty_output><jupyter_text>Training a model<jupyter_code>model.fit(X_train, y_train, epochs=300, batch_size=10)<jupyter_output>Epoch 1/300
105/105 [==============================] - 0s 2ms/step - loss: 1.6388 - acc: 0.2476
Epoch 2/300
105/105 [==============================] - 0s 76us/step - loss: 1.3490 - acc: 0.0000e+00
Epoch 3/300
105/105 [==============================] - 0s 95us/step - loss: 1.2546 - acc: 0.1905
Epoch 4/300
105/105 [==============================] - 0s 86us/step - loss: 1.2030 - acc: 0.3333
Epoch 5/300
105/105 [==============================] - 0s 105us/step - loss: 1.1657 - acc: 0.3333
Epoch 6/300
105/105 [==============================] - 0s 95us/step - loss: 1.1281 - acc: 0.3333
Epoch 7/300
105/105 [==============================] - 0s 76us/step - loss: 1.0956 - acc: 0.3333
Epoch 8/300
105/105 [==============================] - 0s 95us/step - loss: 1.0652 - acc: 0.3333
Epoch 9/300
105/105 [==============================] - 0s 76us/step - loss: 1.0336 - acc: 0.3333
Epoch 10/300
105/105 [==============================] - 0s 86us/step - loss: 1.0076 - acc: 0.3333
Epoch 11/300
105/105 [===[...]<jupyter_text>Evaluate the model<jupyter_code>scores = model.evaluate(X_test, y_test)
print("\nAccuracy: %.2f%%" % (scores[1]*100))<jupyter_output>45/45 [==============================] - 0s 756us/step

Accuracy: 95.56%<jupyter_text>Predict<jupyter_code>prediction = model.predict(X_test)
prediction1 = pd.DataFrame({'IRIS1':prediction[:,0],'IRIS2':prediction[:,1], 'IRIS3':prediction[:,2]})
prediction1.round(decimals=4).head()
real_values = pd.DataFrame(y_test)
real_values.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.21568627450980393, 'fraction_numerical': 0.07426470588235294, 'mean_word_length': 6.58550185873606, 'pattern_counts': {'":': 0, '<': 42, '<?xml version=': 0, '>': 42, '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': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '233969', 'license': 'MIT', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1477, 'n_words': 254, 'path': 'Iris Classification Prediction.ipynb', 'repo_name': 'AnilNITT/Ultimate-TensorFlow-2.O-Updated', 'size': '4080'}