Tutorial-4 Machine Learning with Pandas
Tutorial-4 Machine Learning with Pandas
Some public
methods pandas objects, functions and
Below is a comprehensive table of commonly used Pandas bjects, functions and
methods. For more details you can always refer to the official pandas documentation
Function/Method Description Example Usage
pd.read_csv() Reads a df = pd.read_csv('iris.csv')
CSV file and
file:///Users/debasis/Downloads/Part-III-B Pandas Practice.html 1/19
01/03/2025, 11:14 Part-III-B Pandas Practice
Accesses
data by
df.loc[]
label-based df.loc[0]
indexing
Accesses
data by
integer-
df.iloc[]
location df.iloc[0]
based
indexing
Applies a
function
df.apply() along the df['sepal_length'].apply(lambda
axis of the * 2)
DataFrame
Computes
correlation
df.corr() between df.corr()
numerical
columns
Creates a
plot for
df.plot()
visualizing df['sepal_length'].plot(kind='h
data
Replaces
values in the
df.replace() DataFrame df.replace(5.1, 4.8)
with new
values
Converts
df.astype() the type of a df['sepal_length'] =
column df['sepal_length'].astype(float)
Identifies
duplicate
df.duplicated()
rows in the df.duplicated()
DataFrame
df.drop_duplicates() Removes df.drop_duplicates()
duplicate
rows from
file:///Users/debasis/Downloads/Part-III-B Pandas Practice.html 3/19
01/03/2025, 11:14 Part-III-B Pandas Practice
Note Don't worry about memorizing every Pandas function right away. This tutorial is
just an introduction. As we work with real data, we'll get more comfortable and
remember the functions we use most often. And now a days with internet we are
always free to refer to the offical documentation anytime. Happy learning!
Explanation:
pd.read_csv() loads the CSV file into a DataFrame.
df.head() shows the first 5 rows of the dataset to give an overview.
Expected Output:
The first 5 rows of the Iris dataset, which should include columns like
sepal_length , sepal_width , petal_length , and species .
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 150 entries, 0 to 149
Data columns (total 6 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Id 150 non-null int64
1 SepalLengthCm 150 non-null float64
2 SepalWidthCm 150 non-null float64
3 PetalLengthCm 150 non-null float64
4 PetalWidthCm 150 non-null float64
5 Species 150 non-null object
dtypes: float64(4), int64(1), object(1)
memory usage: 7.2+ KB
Explanation:
df.info() provides information about the number of non-null entries and the
data types of each column.
df.describe() gives statistics like the mean, standard deviation, minimum,
and maximum values for numerical columns.
Out[17]: 0
Id 0
SepalLengthCm 0
SepalWidthCm 0
PetalLengthCm 0
PetalWidthCm 0
Species 0
dtype: int64
Explanation:
df.isnull().sum() shows the number of missing values in each column of
the DataFrame.
B. df.dropna()
In [18]: # Drop rows with missing values
df_cleaned = df.dropna()
Explanation:
df.dropna() removes rows containing missing data from the DataFrame. This
can be useful when you want to discard rows with incomplete information.
C. df.fillna()
In many datasets, some values may be missing. One way to handle missing data is by
filling it with the mean of the column. This method assumes the missing values are
similar to the average value of that column.
In [20]: # Calculate and replace missing values in 'SepalLengthCm' column with its
df_filled = df.fillna(df['SepalLengthCm'].mean())
4. Grouping Data
Grouping data is useful for applying aggregation functions like mean, sum, etc.
Here's an example where we group by species and calculate the mean for each
group.
In [25]: # Group by species and calculate the mean of each numeric column
df.groupby('Species').mean()
Explanation:
df.groupby('species') groups the data by the species column.
.mean() computes the mean for each group in the dataset, giving insights into
the central tendency of the data based on the species.
Expected Output:
A new DataFrame showing the mean of each numeric column for each species of
the Iris flower.
5. Sorting Data
You can sort data by one or more columns to organize the dataset.
In [29]: # Sort the DataFrame by SepalLengthCm
df_sorted = df.sort_values('SepalLengthCm')
df_sorted
Explanation:
kind='hist' creates a histogram.
df['SepalLengthCm'] specifies the column to plot.
Explanation:
kind='box' creates a box plot.
The box plot shows the median, quartiles, and any outliers in the data.
Explanation:
kind='scatter' creates a scatter plot.
x='SepalLengthCm' and y='SepalWidthCm' define the variables for the x
and y axes.
This plot helps identify trends or correlations between the two columns.
Explanation:
kind='line' creates a line plot.
The plot shows the trend of SepalLengthCm over the rows in the dataset.
These are some common types of plots in Pandas that can be used to visualize
various aspects of data, helping with exploratory data analysis (EDA).
In [61]: #Step2: Compute and display the correlation matrix between numerical col
df[list_of_numerical_columns].corr()
Explanation:
list_of_numerical_columns : This is the list of columns to calculate the
correlation for.
.corr() : This method computes the pairwise correlation between the
selected numerical columns in the DataFrame.
file:///Users/debasis/Downloads/Part-III-B Pandas Practice.html 16/19
01/03/2025, 11:14 Part-III-B Pandas Practice
The result is a correlation matrix showing how each numerical column relates to
others, with values ranging from -1 (strong negative correlation) to 1 (strong
positive correlation).
Out[40]: 0
Id 1
SepalLengthCm 5.1
SepalWidthCm 3.5
PetalLengthCm 1.4
PetalWidthCm 0.2
Species Iris-setosa
dtype: object
Explanation:
df.loc[0] retrieves the row with the label 0 from the DataFrame. This is
useful when working with labeled indices.
In [46]: # Access the first row using integer-location based indexing
df.iloc[0]
Out[46]: 0
Id 1
SepalLengthCm 5.1
SepalWidthCm 3.5
PetalLengthCm 1.4
PetalWidthCm 0.2
Species Iris-setosa
dtype: object
Explanation:
df.iloc[0] retrieves the first row by integer position (0-based indexing). This
is useful when working with DataFrames that don't have labeled indices.
Explanation:
df[df['SepalLengthCm'] > 5.0] filters the DataFrame to include only the
rows where the value in the SepalLengthCm column is greater than 5.0. This is
a basic form of data selection and is very useful in exploratory data analysis
(EDA).
SepalLengthCm sepal_length_normalized
0 5.1 0.222222
1 4.9 0.166667
2 4.7 0.111111
3 4.6 0.083333
4 5.0 0.194444
.. ... ...
145 6.7 0.666667
146 6.3 0.555556
147 6.5 0.611111
148 6.2 0.527778
149 5.9 0.444444
Explanation:
df[['SepalLengthCm', 'sepal_length_normalized']] : Selects both
the SepalLengthCm and sepal_length_normalized columns from the DataFrame.
and
df['sepal_length_normalized'] = (df['sepal_length'] -
df['sepal_length'].min()) / (df['sepal_length'].max() -
Congratulations!
You've
completed the tutorial.
Happy
learning!
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 1/17
01/03/2025, 12:37 ML-1 Iris Classification Project
array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2])
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 150 entries, 0 to 149
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 sepal length (cm) 150 non-null float64
1 sepal width (cm) 150 non-null float64
2 petal length (cm) 150 non-null float64
3 petal width (cm) 150 non-null float64
4 target 150 non-null int64
dtypes: float64(4), int64(1)
memory usage: 6.0 KB
None
# Split the dataset into training and testing sets: 67% for training and
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33,
# Note 1: Data (i.e., Data-attributes and Target-column are kept as separ
# Note 2: Here, random_state=42 is chosen as a seed value and popularly i
Step 3: Preprocessing
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 2/17
01/03/2025, 12:37 ML-1 Iris Classification Project
array([[-1.72849788, 0.40824829],
[-0.83223972, 0.81649658],
[-0.38411064, 1.63299316],
[ 0.06401844, -1.63299316],
[ 0.51214752, -0.81649658],
[ 0.9602766 , -0.40824829],
[ 1.40840568, 0. ]])
Normalized testing data set...
array([[-1.13554995, 1.33630621],
[ 1.29777137, -0.26726124],
[-0.16222142, -1.06904497]])
'''
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 3/17
01/03/2025, 12:37 ML-1 Iris Classification Project
'''
# Min-Max scaling
minmax_scaler = MinMaxScaler() # Let MinMaxScalar() be mimax_scalar
X_train_minmax = minmax_scaler.fit_transform(X_train) # Apply fit_tr
X_test_minmax = minmax_scaler.transform(X_test) # Apply transf
print("\nMin-Max Scaled Data (First 5 rows):\n", X_train_minmax[:5])
# Normalization
normalizer = Normalizer() # Let Normalizer() be normalizer
X_train_normalized = normalizer.fit_transform(X_train)
X_test_normalized = normalizer.transform(X_test)
print("\nNormalized Data (First 5 rows):\n", X_train_normalized[:5])
# Polynomial-features scaling
poly = PolynomialFeatures(degree=2, include_bias=False)
X_train_poly = poly.fit_transform(X_train)
X_test_poly = poly.transform(X_test)
print("\nPolynomial Features (First 5 rows):\n", X_train_poly[:5])
'''
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 5/17
01/03/2025, 12:37 ML-1 Iris Classification Project
# Recall: TP/(TP+FN): Tha ratio of true positives to the total actual pot
svm_recall = recall_score(y_test, y_pred, average="weighted")
print("\nReacll : ", svm_recall)
# Specificity calculation
cm = confusion_matrix(y_test, y_pred)
specificity = []
for i in range(len(cm)):
tn = np.sum(cm) - np.sum(cm[i, :]) - np.sum(cm[:, i]) + cm[i, i]
fp = np.sum(cm[:, i]) - cm[i, i]
specificity.append(tn / (tn + fp))
svm_specificity = np.mean(specificity)
print("\nSpecificity: ", svm_specificity)
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 6/17
01/03/2025, 12:37 ML-1 Iris Classification Project
--------------------------------------------------------------------------
-
NameError Traceback (most recent call las
t)
Cell In[1], line 7
3 from sklearn.metrics import roc_auc_score, classification_report
5 # Now, let's get the result of SVM evaluation
6 #Accuracy: (TP+TN)/(TP+TN+FP+FN)
----> 7 svm_accuracy = accuracy_score(y_test, y_pred)
8 print("\nAccuracy:", svm_accuracy)
10 # Precision: TP/(TP+FP): The ratio of TP to the total predicted po
sitives
# Recall: TP/(TP+FN): Tha ratio of true positives to the total actual pot
rf_recall = recall_score(y_test, y_pred, average="weighted")
print("\nReacll : ", rf_recall)
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 7/17
01/03/2025, 12:37 ML-1 Iris Classification Project
# Specificity calculation
cm = confusion_matrix(y_test, y_pred)
specificity = []
for i in range(len(cm)):
tn = np.sum(cm) - np.sum(cm[i, :]) - np.sum(cm[:, i]) + cm[i, i]
fp = np.sum(cm[:, i]) - cm[i, i]
specificity.append(tn / (tn + fp))
rf_specificity = np.mean(specificity)
print("\nSpecificity: ", rf_specificity)
Accuracy: 0.98
Precision: 0.98125
Reacll : 0.98
F1 score: 0.98
Specificity: 0.9904761904761905
accuracy 0.98 50
macro avg 0.98 0.98 0.98 50
weighted avg 0.98 0.98 0.98 50
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 8/17
01/03/2025, 12:37 ML-1 Iris Classification Project
# Recall: TP/(TP+FN): Tha ratio of true positives to the total actual pot
dt_recall = recall_score(y_test, y_pred, average="weighted")
print("\nReacll : ", dt_recall)
# Specificity calculation
cm = confusion_matrix(y_test, y_pred)
specificity = []
for i in range(len(cm)):
tn = np.sum(cm) - np.sum(cm[i, :]) - np.sum(cm[:, i]) + cm[i, i]
fp = np.sum(cm[:, i]) - cm[i, i]
specificity.append(tn / (tn + fp))
dt_specificity = np.mean(specificity)
print("\nSpecificity: ", dt_specificity)
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Clas… 9/17
01/03/2025, 12:37 ML-1 Iris Classification Project
Accuracy: 0.98
Precision: 0.98125
Reacll : 0.98
F1 score: 0.98
Specificity: 0.9904761904761905
accuracy 0.98 50
macro avg 0.98 0.98 0.98 50
weighted avg 0.98 0.98 0.98 50
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 10/17
01/03/2025, 12:37 ML-1 Iris Classification Project
Evaluation
classifier of the performance of Logistic Regression
Evaluation with the simple validation method
In [64]: plot_confusion_matrix(y_test, y_pred, "Ligistic Regression Confusion Matr
# Recall: TP/(TP+FN): Tha ratio of true positives to the total actual pot
lr_recall = recall_score(y_test, y_pred, average="weighted")
print("\nReacll : ", lr_recall)
# Specificity calculation
cm = confusion_matrix(y_test, y_pred)
specificity = []
for i in range(len(cm)):
tn = np.sum(cm) - np.sum(cm[i, :]) - np.sum(cm[:, i]) + cm[i, i]
fp = np.sum(cm[:, i]) - cm[i, i]
specificity.append(tn / (tn + fp))
lr_specificity = np.mean(specificity)
print("\nSpecificity: ", lr_specificity)
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 11/17
01/03/2025, 12:37 ML-1 Iris Classification Project
Accuracy: 0.98
Precision: 0.98125
Reacll : 0.98
F1 score: 0.98
Specificity: 0.9904761904761905
accuracy 0.98 50
macro avg 0.98 0.98 0.98 50
weighted avg 0.98 0.98 0.98 50
XGBoost classifier
Building model with XGBoost classifier
In [82]: # Import XGBoost from sklearn package
from xgboost import XGBClassifier # Import XGBoost classification
# XGBoost Classifier
xgb_model = XGBClassifier(random_state=42, eval_metric='mlogloss') # I
# Note: For details about the paramters see the sklearn manual
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 12/17
01/03/2025, 12:37 ML-1 Iris Classification Project
# Recall: TP/(TP+FN): Tha ratio of true positives to the total actual pot
xgb_recall = recall_score(y_test, y_pred, average="weighted")
print("\nReacll : ", xgb_recall)
# Specificity calculation
cm = confusion_matrix(y_test, y_pred)
specificity = []
for i in range(len(cm)):
tn = np.sum(cm) - np.sum(cm[i, :]) - np.sum(cm[:, i]) + cm[i, i]
fp = np.sum(cm[:, i]) - cm[i, i]
specificity.append(tn / (tn + fp))
xgb_specificity = np.mean(specificity)
print("\nSpecificity: ", xgb_specificity)
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 13/17
01/03/2025, 12:37 ML-1 Iris Classification Project
Accuracy: 0.98
Precision: 0.98125
Reacll : 0.98
F1 score: 0.98
Specificity: 0.9904761904761905
accuracy 0.98 50
macro avg 0.98 0.98 0.98 50
weighted avg 0.98 0.98 0.98 50
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 14/17
01/03/2025, 12:37 ML-1 Iris Classification Project
# Recall: TP/(TP+FN): Tha ratio of true positives to the total actual pot
gb_recall = recall_score(y_test, y_pred, average="weighted")
print("\nReacll : ", gb_recall)
# Specificity calculation
cm = confusion_matrix(y_test, y_pred)
specificity = []
for i in range(len(cm)):
tn = np.sum(cm) - np.sum(cm[i, :]) - np.sum(cm[:, i]) + cm[i, i]
fp = np.sum(cm[:, i]) - cm[i, i]
specificity.append(tn / (tn + fp))
gb_specificity = np.mean(specificity)
print("\nSpecificity: ", gb_specificity)
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 15/17
01/03/2025, 12:37 ML-1 Iris Classification Project
Accuracy: 0.98
Precision: 0.98125
Reacll : 0.98
F1 score: 0.98
Specificity: 0.9904761904761905
accuracy 0.98 50
macro avg 0.98 0.98 0.98 50
weighted avg 0.98 0.98 0.98 50
Comparative
classifiers study on the Performance of Different
In [131… # Plot model accuracies
# Plotting
plt.figure(figsize=(10, 6))
# Set Seaborn style and color palette
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 16/17
01/03/2025, 12:37 ML-1 Iris Classification Project
sns.set_theme(style="whitegrid")
colors = sns.color_palette("viridis", len(models))
#sns.set_palette("viridis") # Set the palette globally
sns.barplot(x=models, y=accuracies, palette=colors, hue=models, dodge=Fal
plt.ylim(0, 1)
plt.title('Model Accuracy Comparison', fontsize=16)
plt.xlabel('Models', fontsize=12)
plt.ylabel('Accuracy', fontsize=12)
plt.xticks(rotation=45, fontsize=10)
plt.yticks(fontsize=10)
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-1 Iris Cl… 17/17
01/03/2025, 12:37 ML-2 Iris Clustering Project
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 1/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 150 entries, 0 to 149
Data columns (total 5 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 sepal length (cm) 150 non-null float64
1 sepal width (cm) 150 non-null float64
2 petal length (cm) 150 non-null float64
3 petal width (cm) 150 non-null float64
4 target 150 non-null int64
dtypes: float64(4), int64(1)
memory usage: 6.0 KB
None
# Split the dataset into training and testing sets: 67% for training and
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33,
# Note 1: Data (i.e., Data-attributes and Target-column are kept as separ
# Note 2: Here, random_state=42 is chosen as a seed value and popularly i
Step 4: Preprocessing
The preprocessing task includes
(a)Handling null-entries, if applicable
(b) Scaling (to put all values in a normalize scale
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 2/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
'''
Note: For normalization, sklearn provides two methods: fit_transform() a
fit_transform() is applied to training data, whereas transform() i
fit_transform() is a combination of fit() (to calculate the necess
transformation based on the training data, such as, min, max, mean
transform() applies the transformation to the data using the param
# Min-Max scaling
minmax_scaler = MinMaxScaler() # Let MinMaxScalar() be mimax_scalar
X_train_minmax = minmax_scaler.fit_transform(X_train) # Apply fit_tr
X_test_minmax = minmax_scaler.transform(X_test) # Apply transf
#print("\nMin-Max Scaled Data (First 5 rows):\n", X_train_minmax[:5])
# Normalization
normalizer = Normalizer() # Let Normalizer() be normalizer
X_train_normalized = normalizer.fit_transform(X_train)
X_test_normalized = normalizer.transform(X_test)
#print("\nNormalized Data (First 5 rows):\n", X_train_normalized[:5])
# Polynomial-features scaling
poly = PolynomialFeatures(degree=2, include_bias=False)
X_train_poly = poly.fit_transform(X_train)
X_test_poly = poly.transform(X_test)
#print("\nPolynomial Features (First 5 rows):\n", X_train_poly[:5])
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 4/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
k_means Clustering
Clustering with partition-based clustering algorithm
In [74]: # KMeans clustering algorithms
DBSCAN Clustering
Clustering with density-based clustering algorithm
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 5/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
# Using the test dataset to assign cluster labels (DBSCAN does not have '
db_labels = db.fit_predict(X_test_scaled) # Predict the cluster label
Agglomerative Clustering
Clustering with hierachical clustering algorithm
In [78]: # Agglomerative clustering algorithms
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 6/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 7/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 8/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
plt.tight_layout()
plt.show()
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Clus… 9/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
ax.set_xticklabels(edf["Models"], rotation=45)
plt.tight_layout()
plt.show()
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Cl… 10/11
01/03/2025, 12:37 ML-2 Iris Clustering Project
file:///Users/debasis/My Drive ([email protected])/Software Engineering Lab/Software Lab Engineering Spring-2025/Lab Assignments/ML-2 Iris Cl… 11/11