Mine 5
Mine 5
ROLL NO : 12212161
Note : WEKA does’t work in my laptop,hence I used Jupyter Notebook,it gives similar results
CODE : All the comments are for the necessary steps followed :
import pandas as pd
import numpy as np
# Load the Iris dataset (or replace this with your dataset)
iris = load_iris()
df = pd.DataFrame(iris.data, columns=iris.feature_names)
# Step 1: Display the first few rows of the dataset
print("Original Data:")
print(df.head())
scaler_minmax = MinMaxScaler()
print(df_minmax.head())
scaler_zscore = StandardScaler()
print(df_zscore.head())
df_decimal = df.copy()
max_val = df_decimal[column].abs().max()
print(df_decimal.head())
df_binned = df.copy()
print(df_binned.head())
plt.figure(figsize=(14, 10))
plt.show()
plt.figure(figsize=(14, 10))
plt.show()
plt.figure(figsize=(14, 10))
plt.show()
plt.figure(figsize=(14, 10))
plt.show()
print(df.describe())
print(df_minmax.describe())
print("\nZ-Score Normalized Data Summary:")
print(df_zscore.describe())
print(df_decimal.describe())
# Step 8: Scatter Plot of Original Data (to visually inspect clustering potential)
plt.figure(figsize=(8, 6))
plt.xlabel(df.columns[0])
plt.ylabel(df.columns[1])
plt.show()
plt.figure(figsize=(10, 7))
plt.xlabel('Samples')
plt.ylabel('Euclidean distances')
plt.show()
wcss = []
kmeans.fit(df)
wcss.append(kmeans.inertia_)
plt.figure(figsize=(8, 6))
plt.plot(range(1, 11), wcss, marker='o', linestyle='--')
plt.xlabel('Number of Clusters')
plt.show()