Airline Reservation
Airline Reservation
Airline Reservation
#Empty list
wcss = []
#fiting X automatically
kmeans.fit(X)
#plotting a figure
plt.figure(figsize=(10,5))
#why elbow to find how many number of clusters are there in the given data
plt.title('The Elbow Method')
plt.xlabel('Number of clusters')
plt.ylabel('WCSS')
plt.show()
#kmeans++ - to iterate values
kmeans = KMeans(n_clusters = 2, init= 'k-means++')
#here Y values will be plot,The scatter() method in the matplotlib library is used
to draw a scatter plot
plt.scatter(X[y_kmeans == 0, 0], X[y_kmeans == 0,1], color = 'yellow', label =
'Cluster 1', s=15)
plt.scatter(X[y_kmeans == 1, 0], X[y_kmeans == 1,1], color = 'blue', label =
'Cluster 2', s=15)
plt.grid(False)
plt.title('Cluster_of_passenger')
plt.xlabel('Customer_ratings'),
plt.ylabel('Age_of_passenger')