Mining Search Logs for Usage Patterns
Join the DZone community and get the full member experience.Join For Free
as i mentioned in a previous post i’ve recently been looking into the challenges of search log analysis and in particular the prospects for deriving a ‘ taxonomy of search sessions ’. the idea is that if we can find distinct, repeatable patterns of behaviour in search logs then we can use these to better understand user needs and therefore deliver a more effective user experience .
we’re not the first to attempt this of course – in fact the whole area of search log analysis has an academic literature which extends back at least a couple of decades. and it is quite topical right now, with both elasticsearch and lucidworks releasing their own logfile analysis tools ( elk and silk respectively). so in this post i’ll be discussing some of the challenges in our own work and sharing some of the initial findings.
so let’s dive in. one of the questions i raised in my last post was:
- what features can be reliably extracted from search sessions within different search logs?
this of course depends on the logs you’re working with, which in our case means a variety of sources, but a good place to start is the aol search log . this log has a somewhat infamous history , but it is useful as it is relatively large and the records contain a variety of fields that offer a range of data mining possibilities. for example, you could extract features such as the following (the citations indicate other researchers who have successfully exploited them):
- query length (stenmark 2008, wolfram 2007): mean # of terms per query
- session duration (chen & cooper 2001, stenmark 2008, weber & jaimes 2011): time from first action to session timeout (e.g. 30 mins).
- number of queries (chen & cooper 2001, stenmark 2008, wolfram 2007, weber & jaimes 2011): any search string entered by the user
- number of viewed hits / items retrieved (chen & cooper 2001, stenmark 2008, weber & jaimes 2011): any link clicked by the user
- requested result pages (stenmark 2008): number of explicit page requests
- number of activities (stenmark 2008): sum of all the interactions with the system
these features are all reasonably straightforward to extract from the aol logs using python or any scripting language of your choice, and the can be output stored as a set of feature vectors for each session. there are of course a great many other features we could extract or derive, and the process of feature selection is something we should consider carefully. but for now i’d like to move onto another question from last week:
- what are the most effective techniques for revealing usage patterns (e.g. unsupervised learning, clustering, etc.)?
at this stage there is no ‘right answer’ in the sense that we don’t know what patterns to expect, so it makes sense to adopt an exploratory strategy and try a few different approaches. we could try clustering them using a data mining tool like weka , for example. weka is useful as it provides an extensive range of algorithms for unsupervised learning and a set of helpful (but somewhat less polished) routines for result visualisation.
so if we take a random sample of 100,000 sessions from the aol log, apply some feature scaling then a clustering algorithm such as expectation maximization we get a result like this:
this reveals 4 clusters, projected into a 2d-space defined by the number of queries & the number of clicks. note that there is nothing magical about the number 4; if you take a different log or use different features you’ll almost certainly get a different result. so it is important to perform multiple iterations, to ensure that the patterns are stable, i.e. replicable across different samples from the same population.
let’s focus for a moment on the image above: what does it tell us? well, not a lot so far: the presence of 4 clusters may be significant but the projection doesn’t deliver much insight into that. instead, we need something like the following:
this shows how the mean values for the 4 clusters vary across the 6 features. but now it’s the data that is somewhat underwhelming: it suggests that we have a group of users who are relatively highly engaged (i.e. demonstrate a lot of interactions), a group who do relatively little and two other groups in between. well, duh – this is hardly the kind of stuff that will have customer research professionals fearing for their jobs.
perhaps the features aren’t ideal? after all we have just 6 so far that were selected on the basis of convenience more than anything. to be maximally useful (e.g. indicative of a latent variable such as ‘behaviour type’), we’d want them to be relatively independent, i.e. uncorrelated with each other. but if we run a pearson correlation across the ones above we find the opposite: most of them are actually highly correlated, particularly pairs such as ‘all actions’ and ‘duration’. perhaps these redundant features are ‘drowning out’ interesting patterns we might otherwise see? let’s try dropping ‘all actions’ and adding in two new features, which are less likely to be correlated with overall engagement levels:
- term use frequency (wolfram 2007): average frequency of usage of each query term within the session
- query interval (wolfram 2007): average time between query submissions within a session
now the results seem a bit more interesting:
- cluster 0 seems to be a relatively small group users who are highly engaged, in long sessions but issuing queries that are diverse / heterogeneous (possibly changing topic repeatedly)
- cluster 1 seems to be a large group of users who engage in short sessions but often repeat their query terms and do more paging than querying
- cluster 2 seems to be a middle or ‘general’ group, whose defining characteristics we’ll know more about when we’ve implemented more features (see below).
so obviously from this point there’s a number of different ways we could go. but instead of just adding more features & applying ever more exotic visualisations to new data sources, it might make sense to take a moment to reflect on the process itself and confirm that what we are doing really is valid and repeatable. one way to do this is to replicate other published studies and compare the results. for example, wolfram’s (2007) paper used the following features:
- session size – the number of queries submitted for the session
- terms used per query – the average number of terms used per query over the session
- term popularity – the average frequency of usage of each query term within the session when
- term use frequency – the average frequency of usage of each query term within the session
- query interval – the average time between query submissions within a session
- pages viewed per query – the average number of page requests per query within a session
he applied these to a number of search logs and showed (among other things) evidence of 4 distinct behavioural patterns in a sample of ~65,000 web search sessions from the excite 2001 data set. if we can replicate his results, then we not only vindicate the specific conclusions he reached, but more importantly, provide evidence that our approach is valid and scalable to new data sources and research questions.
but this is where things seem to go slightly awol. instead of seeing the 4 clusters that wolfram saw, we get something like this:
that’s 3 clusters, not 4. and some very different patterns. now we could of course rationalise these clusters and make various behavioural inferences concerning them, but the point is that with the possible exception of cluster 2, they are very different to wolfram’s. of course, we are using a different log, and our interpretation of the features may vary from his. but either way i’d hoped to see a bit more consistency than this. moreover, when we take a further 3 samples from the aol log, we get a different numbers of clusters (7, 10 and 10)- so the patterns aren’t even replicable within the same population. this happens both for samples sizes of 10,000 and 100,000 sessions (of which the latter take several hours to complete, so this trying out different combinations can take some time).
so something is clearly amiss. it could be a number of things:
- our interpretation of his description of the features, e.g. does query interval mean the elapsed time between any interaction or is it strictly keyword queries, i.e. no paginations or clicks?
- our implementation of them, e.g. should term popularity ignore function words? (if not they can easily dilute the meaning-bearing terms in the query)
- our clustering process: at one point wolfram suggests that in some case he may have set the number of clusters a priori “stable clusters (i.e. replicable) emerge through optimal cluster selection, or specified numbers of clusters ”
or some other factor we have yet to consider.
and on that cliff hanger, i’ll leave you for this week. i’ll follow
up with more news as i get it but if you have any insight or suggestions
re the above, we’d love to hear it.
- chen, h-m., and cooper, m.d. (2001). using clustering techniques to detect usage patterns in a web-based information system. journal of the american society for information science and technology , 52(11): 888– 904.
- jansen, b. j. (2006). search log analysis: what is it; what’s been done; how to do it. library and information science research , 28(3): 407–432.
- stenmark, d. (2008). identifying clusters of user behavior in intranet search engine log files. journal of the american society for information science and technology, 59(14): 2232-2243.
- wolfram, d., wang, p., and zhang, j. (2008). modeling web session behavior using cluster analysis: a comparison of three search settings, in proceedings of the american society for information science and technology , 44(1): 1550-8390.
- weber, i., and jaimes, a. (2011). who uses web search for what: and how? in proceedings of the fourth acm international conference on web search and data mining (wsdm ’11) . acm, new york, ny, usa, 15-24.
Published at DZone with permission of Tony Russell-rose, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.