import pandas as pd
import numpy as np
from collections import Counter
from matplotlib import pyplot as plt
import os
import cv2
%matplotlib inline
%%javascript
IPython.OutputArea.auto_scroll_threshold = 9999;
def load_filepaths():
imdir_ideology = 'ideology_image_dataset/'
ideology_files=os.listdir('ideology_image_dataset/')
ideology_files_path=[os.path.join(imdir_ideology,file) for file in ideology_files ]
return ideology_files_path
ideology_files_path=load_filepaths()
len(ideology_files_path)
2942
def showClustering(predicted_labels,label):
label_indexs= np.where(predicted_labels==label)[0]
print("CLUSTER--> ",label,"TOTAL IMAGES--> ",len(label_indexs))
if(len(label_indexs)>=2000):
print("Cannot be visualize")
else:
if(len(label_indexs)>=500):
fig=plt.figure(figsize=(10, 400))
elif(len(label_indexs)>100 and len(label_indexs)<500):
fig=plt.figure(figsize=(10, 70))
elif(len(label_indexs)>=50 and len(label_indexs)<100):
fig=plt.figure(figsize=(10, 30))
elif(len(label_indexs)>=20 and len(label_indexs)<50):
fig=plt.figure(figsize=(10, 20))
elif(len(label_indexs)>=0 and len(label_indexs)<20):
fig=plt.figure(figsize=(10, 8))
for i,index in enumerate(label_indexs):
image = cv2.imread(ideology_files_path[index])
image= cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
columns = 4
rows = np.ceil(len(label_indexs)/float(columns))
fig.add_subplot(rows,columns, i+1)
plt.imshow(image)
plt.show()
Here we can visualize the results of optics, mean shift and agglomerative clustering . Also we will not visualize the cluster that will more than 2000 images
results_df=pd.read_csv('image-results2/ideology_model_vgg_16.npy.csv')
results_df
Unnamed: 0 | n_clusters | silhouette | calinski | davies | |
---|---|---|---|---|---|
0 | Agglomerative clustering | 2 | 0.052873 | 242.662997 | 2.846778 |
1 | DBSCAN | 0 | -1.000000 | -1.000000 | -1.000000 |
2 | Mean-shift | 51 | 0.099957 | 4.555625 | 0.917647 |
3 | Optics | 51 | -0.195670 | 6.969148 | 1.454804 |
4 | Agglomerative clustering-scipy | 30 | 0.109012 | 6.717517 | 0.991022 |
5 | HDBSCAN | 2 | 0.117461 | 67.867594 | 3.463518 |
predicted_Labels=np.load('image-results2/ideology_model_vgg_16.npy_mean_shift_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 0 TOTAL IMAGES--> 2849 Cannot be visualize CLUSTER--> 1 TOTAL IMAGES--> 2
CLUSTER--> 2 TOTAL IMAGES--> 2
CLUSTER--> 3 TOTAL IMAGES--> 2
CLUSTER--> 4 TOTAL IMAGES--> 3
CLUSTER--> 5 TOTAL IMAGES--> 5
CLUSTER--> 6 TOTAL IMAGES--> 2
CLUSTER--> 7 TOTAL IMAGES--> 2
CLUSTER--> 8 TOTAL IMAGES--> 1
CLUSTER--> 9 TOTAL IMAGES--> 1
CLUSTER--> 10 TOTAL IMAGES--> 2
CLUSTER--> 11 TOTAL IMAGES--> 1
CLUSTER--> 12 TOTAL IMAGES--> 3
CLUSTER--> 13 TOTAL IMAGES--> 2
CLUSTER--> 14 TOTAL IMAGES--> 1
CLUSTER--> 15 TOTAL IMAGES--> 1
CLUSTER--> 16 TOTAL IMAGES--> 1
CLUSTER--> 17 TOTAL IMAGES--> 2
CLUSTER--> 18 TOTAL IMAGES--> 1
CLUSTER--> 19 TOTAL IMAGES--> 1
CLUSTER--> 20 TOTAL IMAGES--> 1
CLUSTER--> 21 TOTAL IMAGES--> 1
CLUSTER--> 22 TOTAL IMAGES--> 1
CLUSTER--> 23 TOTAL IMAGES--> 1
CLUSTER--> 24 TOTAL IMAGES--> 9
CLUSTER--> 25 TOTAL IMAGES--> 2
CLUSTER--> 26 TOTAL IMAGES--> 2
CLUSTER--> 27 TOTAL IMAGES--> 6
CLUSTER--> 28 TOTAL IMAGES--> 1
CLUSTER--> 29 TOTAL IMAGES--> 1
CLUSTER--> 30 TOTAL IMAGES--> 1
CLUSTER--> 31 TOTAL IMAGES--> 1
CLUSTER--> 32 TOTAL IMAGES--> 1
CLUSTER--> 33 TOTAL IMAGES--> 2
CLUSTER--> 34 TOTAL IMAGES--> 1
CLUSTER--> 35 TOTAL IMAGES--> 2
CLUSTER--> 36 TOTAL IMAGES--> 2
CLUSTER--> 37 TOTAL IMAGES--> 1
CLUSTER--> 38 TOTAL IMAGES--> 1
CLUSTER--> 39 TOTAL IMAGES--> 1
CLUSTER--> 40 TOTAL IMAGES--> 1
CLUSTER--> 41 TOTAL IMAGES--> 3
CLUSTER--> 42 TOTAL IMAGES--> 1
CLUSTER--> 43 TOTAL IMAGES--> 1
CLUSTER--> 44 TOTAL IMAGES--> 1
CLUSTER--> 45 TOTAL IMAGES--> 4
CLUSTER--> 46 TOTAL IMAGES--> 1
CLUSTER--> 47 TOTAL IMAGES--> 1
CLUSTER--> 48 TOTAL IMAGES--> 3
CLUSTER--> 49 TOTAL IMAGES--> 1
CLUSTER--> 50 TOTAL IMAGES--> 3
predicted_Labels=np.load('image-results2/ideology_model_vgg_16.npy_optics_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 0 TOTAL IMAGES--> 5
CLUSTER--> 1 TOTAL IMAGES--> 6
CLUSTER--> 2 TOTAL IMAGES--> 8
CLUSTER--> 3 TOTAL IMAGES--> 8
CLUSTER--> 4 TOTAL IMAGES--> 7
CLUSTER--> 5 TOTAL IMAGES--> 5
CLUSTER--> 6 TOTAL IMAGES--> 7
CLUSTER--> 7 TOTAL IMAGES--> 5
CLUSTER--> 8 TOTAL IMAGES--> 7
CLUSTER--> 9 TOTAL IMAGES--> 11
CLUSTER--> 10 TOTAL IMAGES--> 5
CLUSTER--> 11 TOTAL IMAGES--> 15
CLUSTER--> 12 TOTAL IMAGES--> 15
CLUSTER--> 13 TOTAL IMAGES--> 6
CLUSTER--> 14 TOTAL IMAGES--> 6
CLUSTER--> 15 TOTAL IMAGES--> 5
CLUSTER--> 16 TOTAL IMAGES--> 8
CLUSTER--> 17 TOTAL IMAGES--> 6
CLUSTER--> 18 TOTAL IMAGES--> 5
CLUSTER--> 19 TOTAL IMAGES--> 5
CLUSTER--> 20 TOTAL IMAGES--> 6
CLUSTER--> 21 TOTAL IMAGES--> 8
CLUSTER--> 22 TOTAL IMAGES--> 5
CLUSTER--> 23 TOTAL IMAGES--> 5
CLUSTER--> 24 TOTAL IMAGES--> 12
CLUSTER--> 25 TOTAL IMAGES--> 5
CLUSTER--> 26 TOTAL IMAGES--> 5
CLUSTER--> 27 TOTAL IMAGES--> 12
CLUSTER--> 28 TOTAL IMAGES--> 11
CLUSTER--> 29 TOTAL IMAGES--> 9
CLUSTER--> 30 TOTAL IMAGES--> 5
CLUSTER--> 31 TOTAL IMAGES--> 5
CLUSTER--> 32 TOTAL IMAGES--> 6
CLUSTER--> 33 TOTAL IMAGES--> 7
CLUSTER--> 34 TOTAL IMAGES--> 8
CLUSTER--> 35 TOTAL IMAGES--> 12
CLUSTER--> 36 TOTAL IMAGES--> 6
CLUSTER--> 37 TOTAL IMAGES--> 15
CLUSTER--> 38 TOTAL IMAGES--> 6
CLUSTER--> 39 TOTAL IMAGES--> 6
CLUSTER--> 40 TOTAL IMAGES--> 6
CLUSTER--> 41 TOTAL IMAGES--> 6
CLUSTER--> 42 TOTAL IMAGES--> 5
CLUSTER--> 43 TOTAL IMAGES--> 6
CLUSTER--> 44 TOTAL IMAGES--> 5
CLUSTER--> 45 TOTAL IMAGES--> 11
CLUSTER--> 46 TOTAL IMAGES--> 5
CLUSTER--> 47 TOTAL IMAGES--> 5
CLUSTER--> 48 TOTAL IMAGES--> 8
CLUSTER--> 49 TOTAL IMAGES--> 6
CLUSTER--> 50 TOTAL IMAGES--> 5
predicted_Labels=np.load('image-results2/ideology_model_vgg_16.npy_agg-scipy_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 1 TOTAL IMAGES--> 1
CLUSTER--> 2 TOTAL IMAGES--> 1
CLUSTER--> 3 TOTAL IMAGES--> 1
CLUSTER--> 4 TOTAL IMAGES--> 3
CLUSTER--> 5 TOTAL IMAGES--> 1
CLUSTER--> 6 TOTAL IMAGES--> 1
CLUSTER--> 7 TOTAL IMAGES--> 2
CLUSTER--> 8 TOTAL IMAGES--> 2
CLUSTER--> 9 TOTAL IMAGES--> 1
CLUSTER--> 10 TOTAL IMAGES--> 1
CLUSTER--> 11 TOTAL IMAGES--> 1
CLUSTER--> 12 TOTAL IMAGES--> 13
CLUSTER--> 13 TOTAL IMAGES--> 2
CLUSTER--> 14 TOTAL IMAGES--> 2
CLUSTER--> 15 TOTAL IMAGES--> 3
CLUSTER--> 16 TOTAL IMAGES--> 18
CLUSTER--> 17 TOTAL IMAGES--> 1
CLUSTER--> 18 TOTAL IMAGES--> 1
CLUSTER--> 19 TOTAL IMAGES--> 11
CLUSTER--> 20 TOTAL IMAGES--> 26
CLUSTER--> 21 TOTAL IMAGES--> 7
CLUSTER--> 22 TOTAL IMAGES--> 2835 Cannot be visualize CLUSTER--> 23 TOTAL IMAGES--> 1
CLUSTER--> 24 TOTAL IMAGES--> 1
CLUSTER--> 25 TOTAL IMAGES--> 1
CLUSTER--> 26 TOTAL IMAGES--> 1
CLUSTER--> 27 TOTAL IMAGES--> 1
CLUSTER--> 28 TOTAL IMAGES--> 1
CLUSTER--> 29 TOTAL IMAGES--> 1
CLUSTER--> 30 TOTAL IMAGES--> 1
We can viualize the mean shift and the optics here
results_df=pd.read_csv('image-results2/ideology_model_vgg_19.npy.csv')
results_df
Unnamed: 0 | n_clusters | silhouette | calinski | davies | |
---|---|---|---|---|---|
0 | Agglomerative clustering | 2 | 0.103830 | 400.562021 | 2.244039 |
1 | DBSCAN | 0 | -1.000000 | -1.000000 | -1.000000 |
2 | Mean-shift | 38 | 0.111716 | 4.551748 | 0.901795 |
3 | Optics | 56 | -0.213514 | 6.926977 | 1.470868 |
4 | Agglomerative clustering-scipy | 17 | 0.173857 | 5.670576 | 0.762570 |
5 | HDBSCAN | 3 | -0.054606 | 75.892894 | 3.302271 |
predicted_Labels=np.load('image-results2/ideology_model_vgg_19.npy_mean_shift_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 0 TOTAL IMAGES--> 2873 Cannot be visualize CLUSTER--> 1 TOTAL IMAGES--> 2
CLUSTER--> 2 TOTAL IMAGES--> 2
CLUSTER--> 3 TOTAL IMAGES--> 2
CLUSTER--> 4 TOTAL IMAGES--> 2
CLUSTER--> 5 TOTAL IMAGES--> 2
CLUSTER--> 6 TOTAL IMAGES--> 1
CLUSTER--> 7 TOTAL IMAGES--> 1
CLUSTER--> 8 TOTAL IMAGES--> 2
CLUSTER--> 9 TOTAL IMAGES--> 1
CLUSTER--> 10 TOTAL IMAGES--> 3
CLUSTER--> 11 TOTAL IMAGES--> 3
CLUSTER--> 12 TOTAL IMAGES--> 1
CLUSTER--> 13 TOTAL IMAGES--> 1
CLUSTER--> 14 TOTAL IMAGES--> 2
CLUSTER--> 15 TOTAL IMAGES--> 1
CLUSTER--> 16 TOTAL IMAGES--> 7
CLUSTER--> 17 TOTAL IMAGES--> 1
CLUSTER--> 18 TOTAL IMAGES--> 1
CLUSTER--> 19 TOTAL IMAGES--> 1
CLUSTER--> 20 TOTAL IMAGES--> 1
CLUSTER--> 21 TOTAL IMAGES--> 3
CLUSTER--> 22 TOTAL IMAGES--> 1
CLUSTER--> 23 TOTAL IMAGES--> 1
CLUSTER--> 24 TOTAL IMAGES--> 1
CLUSTER--> 25 TOTAL IMAGES--> 3
CLUSTER--> 26 TOTAL IMAGES--> 1
CLUSTER--> 27 TOTAL IMAGES--> 1
CLUSTER--> 28 TOTAL IMAGES--> 1
CLUSTER--> 29 TOTAL IMAGES--> 4
CLUSTER--> 30 TOTAL IMAGES--> 1
CLUSTER--> 31 TOTAL IMAGES--> 1
CLUSTER--> 32 TOTAL IMAGES--> 1
CLUSTER--> 33 TOTAL IMAGES--> 3
CLUSTER--> 34 TOTAL IMAGES--> 2
CLUSTER--> 35 TOTAL IMAGES--> 6
CLUSTER--> 36 TOTAL IMAGES--> 1
CLUSTER--> 37 TOTAL IMAGES--> 1
predicted_Labels=np.load('image-results2/ideology_model_vgg_19.npy_optics_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 0 TOTAL IMAGES--> 7
CLUSTER--> 1 TOTAL IMAGES--> 7
CLUSTER--> 2 TOTAL IMAGES--> 7
CLUSTER--> 3 TOTAL IMAGES--> 8
CLUSTER--> 4 TOTAL IMAGES--> 6
CLUSTER--> 5 TOTAL IMAGES--> 7
CLUSTER--> 6 TOTAL IMAGES--> 6
CLUSTER--> 7 TOTAL IMAGES--> 8
CLUSTER--> 8 TOTAL IMAGES--> 10
CLUSTER--> 9 TOTAL IMAGES--> 19
CLUSTER--> 10 TOTAL IMAGES--> 5
CLUSTER--> 11 TOTAL IMAGES--> 12
CLUSTER--> 12 TOTAL IMAGES--> 8
CLUSTER--> 13 TOTAL IMAGES--> 6
CLUSTER--> 14 TOTAL IMAGES--> 5
CLUSTER--> 15 TOTAL IMAGES--> 6
CLUSTER--> 16 TOTAL IMAGES--> 8
CLUSTER--> 17 TOTAL IMAGES--> 5
CLUSTER--> 18 TOTAL IMAGES--> 8
CLUSTER--> 19 TOTAL IMAGES--> 5
CLUSTER--> 20 TOTAL IMAGES--> 7
CLUSTER--> 21 TOTAL IMAGES--> 5
CLUSTER--> 22 TOTAL IMAGES--> 6
CLUSTER--> 23 TOTAL IMAGES--> 5
CLUSTER--> 24 TOTAL IMAGES--> 5
CLUSTER--> 25 TOTAL IMAGES--> 5
CLUSTER--> 26 TOTAL IMAGES--> 5
CLUSTER--> 27 TOTAL IMAGES--> 8
CLUSTER--> 28 TOTAL IMAGES--> 6
CLUSTER--> 29 TOTAL IMAGES--> 12
CLUSTER--> 30 TOTAL IMAGES--> 7
CLUSTER--> 31 TOTAL IMAGES--> 8
CLUSTER--> 32 TOTAL IMAGES--> 5
CLUSTER--> 33 TOTAL IMAGES--> 7
CLUSTER--> 34 TOTAL IMAGES--> 5
CLUSTER--> 35 TOTAL IMAGES--> 8
CLUSTER--> 36 TOTAL IMAGES--> 6
CLUSTER--> 37 TOTAL IMAGES--> 5
CLUSTER--> 38 TOTAL IMAGES--> 7
CLUSTER--> 39 TOTAL IMAGES--> 5
CLUSTER--> 40 TOTAL IMAGES--> 6
CLUSTER--> 41 TOTAL IMAGES--> 5
CLUSTER--> 42 TOTAL IMAGES--> 6
CLUSTER--> 43 TOTAL IMAGES--> 15
CLUSTER--> 44 TOTAL IMAGES--> 7
CLUSTER--> 45 TOTAL IMAGES--> 12
CLUSTER--> 46 TOTAL IMAGES--> 5
CLUSTER--> 47 TOTAL IMAGES--> 9
CLUSTER--> 48 TOTAL IMAGES--> 5
CLUSTER--> 49 TOTAL IMAGES--> 7
CLUSTER--> 50 TOTAL IMAGES--> 5
CLUSTER--> 51 TOTAL IMAGES--> 6
CLUSTER--> 52 TOTAL IMAGES--> 5
CLUSTER--> 53 TOTAL IMAGES--> 11
CLUSTER--> 54 TOTAL IMAGES--> 6
CLUSTER--> 55 TOTAL IMAGES--> 5
results_df=pd.read_csv('image-results2/ideology_model_resnet50.npy.csv')
results_df
Unnamed: 0 | n_clusters | silhouette | calinski | davies | |
---|---|---|---|---|---|
0 | Agglomerative clustering | 2 | 0.050838 | 192.773120 | 3.319562 |
1 | DBSCAN | 0 | -1.000000 | -1.000000 | -1.000000 |
2 | Mean-shift | 42 | 0.114504 | 3.044071 | 0.784067 |
3 | Optics | 53 | -0.143944 | 8.001208 | 1.526539 |
4 | Agglomerative clustering-scipy | 211 | 0.025470 | 5.737732 | 1.150174 |
5 | HDBSCAN | 12 | -0.128384 | 18.965519 | 2.631275 |
predicted_Labels=np.load('image-results2/ideology_model_resnet50.npy_mean_shift_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 0 TOTAL IMAGES--> 2886 Cannot be visualize CLUSTER--> 1 TOTAL IMAGES--> 4
CLUSTER--> 2 TOTAL IMAGES--> 2
CLUSTER--> 3 TOTAL IMAGES--> 2
CLUSTER--> 4 TOTAL IMAGES--> 2
CLUSTER--> 5 TOTAL IMAGES--> 1
CLUSTER--> 6 TOTAL IMAGES--> 1
CLUSTER--> 7 TOTAL IMAGES--> 4
CLUSTER--> 8 TOTAL IMAGES--> 1
CLUSTER--> 9 TOTAL IMAGES--> 3
CLUSTER--> 10 TOTAL IMAGES--> 1
CLUSTER--> 11 TOTAL IMAGES--> 1
CLUSTER--> 12 TOTAL IMAGES--> 1
CLUSTER--> 13 TOTAL IMAGES--> 1
CLUSTER--> 14 TOTAL IMAGES--> 1
CLUSTER--> 15 TOTAL IMAGES--> 1
CLUSTER--> 16 TOTAL IMAGES--> 2
CLUSTER--> 17 TOTAL IMAGES--> 1
CLUSTER--> 18 TOTAL IMAGES--> 1
CLUSTER--> 19 TOTAL IMAGES--> 2
CLUSTER--> 20 TOTAL IMAGES--> 1
CLUSTER--> 21 TOTAL IMAGES--> 2
CLUSTER--> 22 TOTAL IMAGES--> 1
CLUSTER--> 23 TOTAL IMAGES--> 1
CLUSTER--> 24 TOTAL IMAGES--> 1
CLUSTER--> 25 TOTAL IMAGES--> 1
CLUSTER--> 26 TOTAL IMAGES--> 1
CLUSTER--> 27 TOTAL IMAGES--> 1
CLUSTER--> 28 TOTAL IMAGES--> 2
CLUSTER--> 29 TOTAL IMAGES--> 1
CLUSTER--> 30 TOTAL IMAGES--> 1
CLUSTER--> 31 TOTAL IMAGES--> 1
CLUSTER--> 32 TOTAL IMAGES--> 1
CLUSTER--> 33 TOTAL IMAGES--> 1
CLUSTER--> 34 TOTAL IMAGES--> 1
CLUSTER--> 35 TOTAL IMAGES--> 1
CLUSTER--> 36 TOTAL IMAGES--> 1
CLUSTER--> 37 TOTAL IMAGES--> 1
CLUSTER--> 38 TOTAL IMAGES--> 1
CLUSTER--> 39 TOTAL IMAGES--> 1
CLUSTER--> 40 TOTAL IMAGES--> 1
CLUSTER--> 41 TOTAL IMAGES--> 1
predicted_Labels=np.load('image-results2/ideology_model_resnet50.npy_mean_shift_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 0 TOTAL IMAGES--> 2886 Cannot be visualize CLUSTER--> 1 TOTAL IMAGES--> 4
CLUSTER--> 2 TOTAL IMAGES--> 2
CLUSTER--> 3 TOTAL IMAGES--> 2
CLUSTER--> 4 TOTAL IMAGES--> 2
CLUSTER--> 5 TOTAL IMAGES--> 1
CLUSTER--> 6 TOTAL IMAGES--> 1
CLUSTER--> 7 TOTAL IMAGES--> 4
CLUSTER--> 8 TOTAL IMAGES--> 1
CLUSTER--> 9 TOTAL IMAGES--> 3
CLUSTER--> 10 TOTAL IMAGES--> 1
CLUSTER--> 11 TOTAL IMAGES--> 1
CLUSTER--> 12 TOTAL IMAGES--> 1
CLUSTER--> 13 TOTAL IMAGES--> 1
CLUSTER--> 14 TOTAL IMAGES--> 1
CLUSTER--> 15 TOTAL IMAGES--> 1
CLUSTER--> 16 TOTAL IMAGES--> 2
CLUSTER--> 17 TOTAL IMAGES--> 1
CLUSTER--> 18 TOTAL IMAGES--> 1
CLUSTER--> 19 TOTAL IMAGES--> 2
CLUSTER--> 20 TOTAL IMAGES--> 1
CLUSTER--> 21 TOTAL IMAGES--> 2
CLUSTER--> 22 TOTAL IMAGES--> 1
CLUSTER--> 23 TOTAL IMAGES--> 1
CLUSTER--> 24 TOTAL IMAGES--> 1
CLUSTER--> 25 TOTAL IMAGES--> 1
CLUSTER--> 26 TOTAL IMAGES--> 1
CLUSTER--> 27 TOTAL IMAGES--> 1
CLUSTER--> 28 TOTAL IMAGES--> 2
CLUSTER--> 29 TOTAL IMAGES--> 1
CLUSTER--> 30 TOTAL IMAGES--> 1
CLUSTER--> 31 TOTAL IMAGES--> 1
CLUSTER--> 32 TOTAL IMAGES--> 1
CLUSTER--> 33 TOTAL IMAGES--> 1
CLUSTER--> 34 TOTAL IMAGES--> 1
CLUSTER--> 35 TOTAL IMAGES--> 1
CLUSTER--> 36 TOTAL IMAGES--> 1
CLUSTER--> 37 TOTAL IMAGES--> 1
CLUSTER--> 38 TOTAL IMAGES--> 1
CLUSTER--> 39 TOTAL IMAGES--> 1
CLUSTER--> 40 TOTAL IMAGES--> 1
CLUSTER--> 41 TOTAL IMAGES--> 1
results_df=pd.read_csv('image-results2/ideology_model_inceptionv3.npy.csv')
results_df
Unnamed: 0 | n_clusters | silhouette | calinski | davies | |
---|---|---|---|---|---|
0 | Agglomerative clustering | 2 | 0.383595 | 1902.910288 | 1.186455 |
1 | DBSCAN | 0 | -1.000000 | -1.000000 | -1.000000 |
2 | Mean-shift | 49 | 0.263252 | 76.792516 | 2.044841 |
3 | Optics | 28 | -0.393399 | 11.928438 | 1.333732 |
4 | Agglomerative clustering-scipy | 2 | 0.522594 | 749.840801 | 0.830656 |
5 | HDBSCAN | 3 | 0.356685 | 649.991763 | 1.457040 |
predicted_Labels=np.load('image-results2/ideology_model_inceptionv3.npy_mean_shift_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)
CLUSTER--> 0 TOTAL IMAGES--> 2199 Cannot be visualize CLUSTER--> 1 TOTAL IMAGES--> 78
CLUSTER--> 2 TOTAL IMAGES--> 8
CLUSTER--> 3 TOTAL IMAGES--> 18
CLUSTER--> 4 TOTAL IMAGES--> 14
CLUSTER--> 5 TOTAL IMAGES--> 3
CLUSTER--> 6 TOTAL IMAGES--> 2
CLUSTER--> 7 TOTAL IMAGES--> 2
CLUSTER--> 8 TOTAL IMAGES--> 2
CLUSTER--> 9 TOTAL IMAGES--> 18
CLUSTER--> 10 TOTAL IMAGES--> 1
CLUSTER--> 11 TOTAL IMAGES--> 1
CLUSTER--> 12 TOTAL IMAGES--> 10
CLUSTER--> 13 TOTAL IMAGES--> 1
CLUSTER--> 14 TOTAL IMAGES--> 2
CLUSTER--> 15 TOTAL IMAGES--> 3
CLUSTER--> 16 TOTAL IMAGES--> 5
CLUSTER--> 17 TOTAL IMAGES--> 14
CLUSTER--> 18 TOTAL IMAGES--> 8
CLUSTER--> 19 TOTAL IMAGES--> 21
CLUSTER--> 20 TOTAL IMAGES--> 1
CLUSTER--> 21 TOTAL IMAGES--> 17
CLUSTER--> 22 TOTAL IMAGES--> 9
CLUSTER--> 23 TOTAL IMAGES--> 1
CLUSTER--> 24 TOTAL IMAGES--> 28
CLUSTER--> 25 TOTAL IMAGES--> 5
CLUSTER--> 26 TOTAL IMAGES--> 94
CLUSTER--> 27 TOTAL IMAGES--> 5
CLUSTER--> 28 TOTAL IMAGES--> 9
CLUSTER--> 29 TOTAL IMAGES--> 1
CLUSTER--> 30 TOTAL IMAGES--> 4
CLUSTER--> 31 TOTAL IMAGES--> 43
CLUSTER--> 32 TOTAL IMAGES--> 9
CLUSTER--> 33 TOTAL IMAGES--> 10
CLUSTER--> 34 TOTAL IMAGES--> 1
CLUSTER--> 35 TOTAL IMAGES--> 11
CLUSTER--> 36 TOTAL IMAGES--> 74
CLUSTER--> 37 TOTAL IMAGES--> 45
CLUSTER--> 38 TOTAL IMAGES--> 1
CLUSTER--> 39 TOTAL IMAGES--> 35
predicted_Labels=np.load('image-results2/ideology_model_inceptionv3.npy_mean_shift_labels.npy')
unique_labels=set(predicted_Labels)
for label in unique_labels:
if(label!=-1):
showClustering(predicted_Labels,label)