text
stringlengths
0
89.3k
value of the weight increases proportionally to the number of
times a term appears in the post and is offset by the number
of posts containing that term
wijTFIDF tiej TFtiejIDF ti10
Table 2 illustrates the vector representation of a social graph
containing pposts and nterms using the vector space model
with TFIDF weighting measure
TermsPostse1 e2 e3 ep
term 1 0015 0342 0 0
term 2 0231 1164 0324 1002
term 3 0 0102 0 0076
term n 1562 0 0067 0
Table 2 Vector representation with TFIDF
Once the posts are cleaned and represented as weighted vec
tors of terms the clustering phase can be launched using k
means algorithm
C Clusters initialization
A centroid is assigned to each cluster amongst the posts
of the social graph Each centroid is represented by the
weighted terms vector of its corresponding post The kcen
troids m1 m2 m kare initialized randomly by choosing
krandom posts The pseudo code of the initialization is pre
sented in Algorithm 2
Algorithm 2 Centroids Initialization
Input E posts of the social graph Gk number of clus
ters
Output kcentroids
1fori1tokdo
2 rrandom position
3 mier
4 Insert miinCentroids
5end for
6Return Centroids
Once the centroids defined the clusters are populated with
posts based on the distance between each post and the clus
ters centroids To compute this distance we use the Euclid
ian distance measure which represents the ordinary straight
line distance between two points in Euclidean space In our
case each point is either a post eior a centroid mj both rep
resented by a weighted terms vector In an ndimensional
space the distance is calculated using Formula 11
dei mj vuutnX
l1eilmjl21135 Y Drias et al
Where
n represents the vectors size
mjl represents the weight of term lin the centroid mj
eil represents the weight of term lin post ei
The pseudo code of the clusters construction is presented in
Algorithm 3
Algorithm 3 Clusters construction
Input E posts of the social graph GCentroids cen
troids vectors
Output S set of clusters
1for all eiEdo
2 mindist
3 cluster id 1
4 for all mjCentroids do
5 compute the distance dei mjusing Formula
11
6 ifdei mj min distthen
7 cluster idj
8 end if
9 end for
10 Insert eiin the right cluster Scluster id
11end for
12Return S
D Centroids update
The centroids are updated throughout the iterations of the k
means algorithm Their positions are recalculated and moved
towards the center of their respective clusters at the end of
each iteration For this purpose the mean weighted terms
vector µis computed for each cluster This vector represents
the average weight of each term in all the posts belonging
to the cluster and will be used to define the new clusters
centroid After generating the vector µjof the cluster Sj
the distance between this vector which doesnt constitute a
real social post and each post of the cluster Sjis calculated
in order to select the nearest post to µjand set it as the new
centroid mj This process is detailed in Algorithm 4
E Kmeans algorithm for territories definition
Kmeans algorithm is launched prior to the information for
aging process in order to define search territories and there
fore divide the search space into multiple clusters based on
the content of the social posts Once the centroids are ini
tialized the algorithm enters a loop composed of two main
steps The first takes in charge the clusters creation by as
signing each post of the social graph to the cluster whose
centroid is the nearest The second step defines a new cen
troid for each cluster based on the mean of the weighted
terms vectors of all posts assigned to that cluster The stop
condition of the loop is either convergence or the reach of
a maximum number of iterations The territories definition
process using kmeans clustering is presented in Algorithm
5
Note that the time complexity of the algorithm is estimated to
Onmkl with nbeing the total number of posts in theAlgorithm 4 Centroids update
Input Sj a cluster
Output mj the new clusters centroid
1µj00 0