urce: Data from B. Behlendorf and P. M. Hallam-Baker. Extended log file format. Technical report, W3C Working Draf WD-logfile-960323. http://www. w3.org/TR/WD-logfile, 1996. Service Delivery Platforms C - ip: The IP address is used to localize the user; the localities are organized into a hierarchy of continent, region, country, city, town, and SO on. CS (User Agent): Gives information about the user Browser and operating system (OS) further than their languages. C - Device: Characterizes the used device for the user interaction; devices can be segmented into a hierarchy. A conjunction of these attributes represents contexts within which users inter- act with the RS. We propose to group these contexts into clusters, each representing a regular context or situation such as home, labs, and SO on. Context Discovery Algorithm. Log files are transformed and uploaded into a database relation having the schema of Table 10.1. Based on this table, contexts are discovered by mining the five contextual attributes given above. Let a context tuple be a conjunction of the five contextual attributes, which cor- responds to one row (see Table 10.1). The idea is to cluster the set of all tuples into a finite set of clusters, each cluster representing a particular regular context. Thus, we start by applying the Agglomerative Hierarchical Clustering (AHC) [26] in order to estimate the number of clusters k, and then, we apply the k-means algorithm with the k center of resulting clusters in AHC algorithm instead of choosing arbitrarily the initial k centers. Obviously, both AHC and k-means use a metric to capture the similarity between contexts. This is given by a matching service that will be presented later in Section 10.4.4. ALGORITHM AUTOMATIC CONTEXTS DISCOVERY Input: the user log file L, the threshold a. Output: the set of user contexts ={c1,...,cm}, CK-, E:= 2: CI - CONTEXT (L) {extract context instances} Ct AHC (CI, a) {apply AHC with stopping threshold a} 4 : for all cluster Ci e CIdo 5: update its mean mi =NewMean(c) 6: rep