The invention relates generally to computer systems, and more particularly to an improved system and method for clustering objects using indexes for a matrix representing a collection of objects.
There may be many applications that may use hierarchical clustering to identify related groups of users or objects. The relationship of objects may be represented by a matrix that is often sparse. A classic algorithm, called the “single-link algorithm”, may be typically used for producing hierarchical clustering of objects whose relationship may be represented by a sparse matrix. This classic algorithm may compute the similarities between all pairs of rows and produce a complete list of pairs sorted by similarity. Kruskal's maximum-spanning tree algorithm may then be applied to the list of pairs sorted by similarity to generate clusters by merging nodes.
Although functional, this method may be expensive and may result in an undesirable output tree. For instance, there may be M2 pairs of rows, so computing and sorting all of the similarities can be too expensive both in terms of time and space. Second, rather than producing a wider and shallower tree, the output tree generated can be very unbalanced and deep. In order to generate a shallower tree, a modified version of Kruskal's algorithm may be applied that may proceed in about log n rounds. In each round, the modified version of Kruskal's algorithm may merge nodes with nodes and nodes with clusters, but not clusters with clusters. Between rounds, clusters are contracted into new nodes. This still may remain very expensive, because the input to Kruskal's algorithm may be a sorted list of all node pairs.
What is needed is a way to more efficiently perform hierarchical clustering for identifying related groups of users or objects. Such a system and method should work for any type of objects, including objects that may be clusters themselves so that clusters may be correlated into a hierarchy of clusters.
Briefly, the present invention may provide a system and method for clustering objects using indexes for a matrix representing a collection of objects. To do so, a clustering analysis engine may be provided that may provide services for grouping objects into clusters of objects. In an embodiment, a clustering analysis engine may include an operably coupled index generator for creating indexes on the rows and columns of a matrix representing the objects to be clustered, a correlation analyzer for identifying objects which may be correlated, and a cluster generator for creating clusters by joining correlated objects in the same cluster. In an embodiment, the objects may be clusters themselves that may be correlated into a hierarchy of clusters. In particular, objects to be clustered may be represented as a rectangular matrix. An index may be created for accessing the rows of the matrix and an inverted index may be created for accessing the columns of the matrix based upon the connectivity of the edges between rows and columns of the matrix. Each node represented by a row may be joined to a nearest node represented by another row to produce disjoint sets of nodes. The nearest node represented by a row may be efficiently found by using the index and inverted index to find rows with nonzero overlap with the row representing the initial node. The disjoint sets of nodes may represent clusters that may then be output for use by an application.
The present invention may support many applications for clustering objects using indexes for a matrix. For example, an application may wish to cluster groups of online users according to membership lists. Or an application for online advertisement auctions may wish to cluster bidded phrases according to bidding patterns. For any of these applications, objects with related attributes or classes of attributes may be represented by a matrix and efficiently clustered using indexes for the matrix. Furthermore, the present invention may also correlate clusters of objects to produce a hierarchy of clusters.
Advantageously, the present invention may use an index and an inverted index to efficiently compute similarities between objects represented by a matrix for clustering. Any types of objects with related attributes or classes of attributes may be represented by a matrix and clustered using indexes for the matrix. Other advantages will become apparent from the following detailed description when taken in conjunction with the drawings, in which:
The invention may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, and so forth, which perform particular tasks or implement particular abstract data types. The invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in local and/or remote computer storage media including memory storage devices.
With reference to
The computer system 100 may include a variety of computer-readable media. Computer-readable media can be any available media that can be accessed by the computer system 100 and includes both volatile and nonvolatile media. For example, computer-readable media may include volatile and nonvolatile computer storage media implemented in any method or technology for storage of information such as computer-readable instructions, data structures, program modules or other data. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can accessed by the computer system 100. Communication media may include computer-readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. The term “modulated data signal” means a signal that has one or more of its characteristics set or changed in such a manner as to encode information in the signal. For instance, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, RF, infrared and other wireless media.
The system memory 104 includes computer storage media in the form of volatile and/or nonvolatile memory such as read only memory (ROM) 106 and random access memory (RAM) 110. A basic input/output system 108 (BIOS), containing the basic routines that help to transfer information between elements within computer system 100, such as during start-up, is typically stored in ROM 106. Additionally, RAM 110 may contain operating system 112, application programs 114, other executable code 116 and program data 118. RAM 110 typically contains data and/or program modules that are immediately accessible to and/or presently being operated on by CPU 102.
The computer system 100 may also include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only,
The drives and their associated computer storage media, discussed above and illustrated in
The computer system 100 may operate in a networked environment using a network 136 to one or more remote computers, such as a remote computer 146. The remote computer 146 may be a personal computer, a server, a router, a network PC, a peer device or other common network node, and typically includes many or all of the elements described above relative to the computer system 100. The network 136 depicted in
The present invention is generally directed towards a system and method for clustering objects using indexes for a matrix representing a collection of objects. More particularly, objects to be clustered may be represented as a rectangular matrix. An index may be created for accessing the rows of the matrix and an index may be created for accessing the columns of the matrix based upon the connectivity of the edges between rows and columns of the matrix. Each node represented by a row may be joined to a nearest node represented by another row to produce disjoint sets of nodes. The disjoint sets of nodes may represent clusters that may then be output for use by an application.
As will be seen, the present invention may support many applications for clustering objects using indexes for a matrix representing the objects to be clustered. For example, an application may wish to cluster groups of online users according to membership lists. Furthermore, the present invention may also correlate clusters of objects to produce a hierarchy of clusters. As will be understood, the various block diagrams, flow charts and scenarios described herein are only examples, and there are many other scenarios to which the present invention will apply.
Turning to
In various embodiments, a computer 202, such as computer system 100 of
The clustering analysis engine 204 may provide services for grouping objects 214 into clusters 216 of objects 218. In an embodiment, the objects 214 may be clusters themselves that may be correlated into a hierarchy of clusters. The clustering analysis engine 204 may include an index generator 206 for creating indexes on the rows and columns of a matrix representing the objects to be clustered, a correlation analyzer for identifying objects which may be correlated. Each of these modules may also be any type of executable software code such as a kernel component, an application program, a linked library, an object with methods, or other type of executable software code. The clustering analysis engine 204 may create clusters by joining correlated objects in the same cluster.
There are many applications which may use the present invention for clustering objects using indexes for a matrix. For example, an application may wish to cluster groups of online users according to membership lists. Or an application for online advertisement auctions may wish to cluster bidded phrases according to bidding patterns. For any of these applications, objects with related attributes or classes of attributes may be represented by a matrix and clustered using indexes for the matrix. Furthermore, those skilled in the art will appreciate that the present invention may also correlate clusters of objects to produce a hierarchy of clusters.
Once the relationship between objects and classes of attributes may be represented as an m×n matrix, indexes may be created at step 304 for the M nodes and the N nodes based on the connectivity of the edges between M and N. In an embodiment, a forward index for the M nodes representing rows of the matrix may be created. For example, an array, which may be denoted as R, may be created that includes a list of nonzero columns for each row and another array that stores the offset to the array R for each row. Thus, the forward index may map objects to attributes. A backward index for the N nodes representing the columns of the matrix may also be created. For instance, an array, which may be denoted as O, may be created that includes a list of nonzero rows for each column and another array that stores an offset to the array O for each column. Accordingly, the backward index may map attributes to objects.
Each node in M may then be joined to a nearest node in M to produce disjoint sets of nodes at step 306. These disjoint sets of nodes may represent individual clusters. In an embodiment, a depth-2 depth first search (DFS) may be performed on the nodes of M, first using the forward index and then using the backward index, to find a most correlated connected node in M that may be joined into a disjoint set using a union-find algorithm. An indication of the disjoint sets representing individual clusters of objects may then be output at step 308 and processing may be finished for clustering objects using indexes for a matrix.
At step 404, the backward index on N may be used to map each found column node zj in Z to the subset Yj of row nodes connected to zj by an edge in the bipartite graph representing the matrix. Consider C to denote the union of the sets Yj, and for each row node yk in C, consider ov(k) to denote the number of times the node yk was seen while computing this union.
Note that the nodes yk in C may be exactly those nodes that are two steps away from the current node ym in the bipartite graph representing the matrix. Therefore, steps 402 and 404 can also be described as performing a depth-2 DFS. The rows corresponding to the nodes yk in C may be exactly those rows with nonzero overlap with the row corresponding to ym. The counts ov(k) may represent the overlaps, from which several different similarity scores including correlation and cosine similarity may be computed.
At step 406, correlated nodes in M may be determined by using the overlaps ov(k) to compute one of several similarity scores (including correlation and cosine similarity) between the current node xm and each node yk in C. The row node ym in C that may be most correlated with xm may then be chosen.
The current node xm, which may have a correlation of 1, may be excluded from consideration of the nodes of C when determining a most correlated node ym. In other embodiments, weights may be used for nodes or edges or both to determine correlation. In such embodiments, edge weights on indexes may be pre-computed and stored, and node weights on an indexed array may be pre-computed and stored.
At step 408, each node xm may be joined with its most correlated node ym. In an embodiment, a node xm may be joined with a correlated node ym if the similarity metric may exceed a defined threshold. In various embodiments, the nodes of M may be stored on a disjoint sets data structure and may be joined using a well-known union-find algorithm. The result of joining nodes xm with correlated nodes ym may produce disjoint sets of nodes representing individual clusters. When the disjoint sets of nodes may have been produced, processing may be finished for producing disjoint sets of nearest nodes of a matrix accessed using indexes.
A hierarchical clustering may be produced by iterating the steps generally described in conjunction with
At step 504, the nodes represented by rows of the matrix may be joined to produce disjoint sets representing clusters of a level of the hierarchical clustering. In an embodiment, the steps of
At step 506, the disjoint sets representing clusters of a level of the hierarchical clustering may be stored. And it may be determined at step 508 whether the number of levels of the hierarchical clustering may be less than a threshold. If so, then the objects of a disjoint set may be combined for each of the disjoint sets to create a rectangular matrix of meta-objects and processing may continue at step 504. The objects of a disjoint set may be combined in an embodiment by OR'ing or summing the rows of objects belonging to the disjoint set, or by contracting the object nodes of a disjoint set in the bipartite graph view of the relationship of the collection of objects or clusters. Note that the rectangular matrix of meta-objects may represent the relationship between clusters and attributes, or clusters of attributes at a level of the hierarchical clustering. In various embodiments, a weighted version of the clustering algorithm may be used for clustering at levels 2 and above of the hierarchical clustering.
If it may be determined at step 508 that the number of levels of the hierarchical clustering may not be less than a threshold, the collection of disjoint sets representing each level of the hierarchical clustering may be output at step 510, and processing may be finished for performing hierarchical clustering by correlating clusters at each level of the hierarchy of clusters using indexes for a matrix representing a relationship between clusters.
In an alternate embodiment, a hierarchical clustering may be produced by iterating the steps generally described in conjunction with
At step 604, the nodes represented by rows of the matrix may be used to produce singleton disjoint sets representing singleton clusters of a first level of the hierarchical clustering. At step 606, the similarities between pairs of objects that have nonzero overlap may be computed. In an embodiment, any of the several similarity scores (including correlation and cosine similarity) described in conjunction with step 406 of
At step 608, the computed similarities between pairs of objects producing the similarities between pairs of clusters of the level of the hierarchical clustering may be aggregated. In an embodiment, the computed similarities between pairs of objects may be combined using aggregation operators, such as minimum, maximum and average, into aggregated similarities between pairs of clusters. At step 610, the disjoint set representing each cluster of the level of the hierarchical clustering may be merged with its nearest neighbor according to the aggregated similarities between pairs of clusters. This may produce in an embodiment a smaller collection of bigger disjoint sets that may be viewed as the next level of the hierarchical clustering.
It may then be determined at step 612 whether the number of levels of the hierarchical clustering may be less than a threshold. If so, then processing may continue at step 606, and the similarities between pairs of objects that have nonzero overlap may be computed If it may be determined at step 612 that the number of levels of the hierarchical clustering may not be less than a threshold, the collection of disjoint sets representing each level of the hierarchical clustering may be output at step 614, and processing may be finished for performing hierarchical clustering by correlating clusters at each level of the hierarchy of clusters using indexes for a matrix representing a relationship between clusters.
Those skilled in the art will appreciate that the present invention may also be used to perform collaborative filtering to identify clusters of attributes for clusters of objects such as identifying a music playlist of a group of people. To do so, the methods of the present invention described by
Thus the present invention may efficiently cluster objects that may be represented by a large matrix that may be sparse. Advantageously, large similarities and near neighbors represented by the edges of the matrix may be computed by performing a depth first search-2. Thus, the cost of computing near neighbors over the rows may be the sum of the squares of the degrees of column nodes, which may be significantly less in practice than the number of rows squared. Moreover, the computation may be flexibly performed in parallel as desired. By joining correlated nodes using a union-find algorithm, the merging of nearest nodes may take nearly linear time. Thus, the cost of computing the nearest neighbors may represent the dominant cost for clustering objects.
As can be seen from the foregoing detailed description, the present invention provides an improved system and method for clustering objects using indexes for a matrix representing a collection of objects. Any collection of objects may be grouped into clusters of objects. Notably, the objects may be clusters themselves that may be correlated into a hierarchy of clusters. To produce higher levels of the hierarchy, additional rounds of merging may be performed after joining the clusters into metanodes and/or defining a similarity function suitable for clusters. Such a system and method may support many applications that may cluster a collection of objects. As a result, the system and method provide significant advantages and benefits needed in contemporary computing.
While the invention is susceptible to various modifications and alternative constructions, certain illustrated embodiments thereof are shown in the drawings and have been described above in detail. It should be understood, however, that there is no intention to limit the invention to the specific forms disclosed, but on the contrary, the intention is to cover all modifications, alternative constructions, and equivalents falling within the spirit and scope of the invention.