Sparse Semantic Hashing for Efficient Large Scale Similarity Search Qifan Wang, Bin Shen, Zhiwei Zhang and Luo Si Department of Computer Science Purdue University West Lafayette, IN 47907, US

{wang868, bshen, zhan1187, lsi}@purdue.edu ABSTRACT Similarity search, or finding approximate nearest neighbors, is an important technique in various large scale information retrieval applications such as document retrieval. Many recent research demonstrate that hashing methods can achieve promising results for large scale similarity search due to its computational and memory efficiency. However, most existing hashing methods ignore the hidden semantic structure of documents but only use the keyword features (e.g., tf-idf) in hashing codes learning. This paper proposes a novel sparse semantic hashing (SpSH) approach that explores the hidden semantic representation of documents in learning their corresponding hashing codes. In particular, a unified framework is designed for ensuring the hidden semantic structure among the documents by a sparse coding model, while at the same time preserving the document similarity via graph Laplacian. An iterative coordinate descent procedure is then proposed for solving the optimization problem. Extensive experiments on two large scale datasets demonstrate the superior performance of the proposed research over several state-of-the-art hashing methods.

Categories and Subject Descriptors H.3.1 [Information Storage and Retrieval]: Content Analysis and Indexing

Keywords Hashing; Similarity Search; Sparse Coding

1.

INTRODUCTION

Similarity search, also known as approximate nearest neighbor search, is a key problem in many information retrieval applications including document and image retrieval [5], similar content reuse detection [11] and collaborative filtering [12]. The purpose of similarity search is to identify similar data examples given a query example. With the Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]. CIKM’14, November 3–7, 2014, Shanghai, China. Copyright 2014 ACM 978-1-4503-2598-1/14/11 ...$15.00. http://dx.doi.org/10.1145/2661829.2662145.

explosive growth of the internet, a huge amount of data have been generated, which indicates that efficient similarity search with large scale data becomes more important. Traditional similarity search methods are difficult to be used directly for large scale data since computing the similarity using the original features (i.e., often in high dimensional space) exhaustively between the query example and every candidate example is impractical for large applications. Recently, hashing methods [6, 7, 8, 9, 10] have been successfully used for large scale similarity search due to its fast query speed and low storage cost. These hashing methods design compact binary code in a low-dimensional space for each document so that similar documents are mapped to similar binary codes. In the retrieval process, these hashing methods first transform each query example into its corresponding binary code. Then similarity search can be simply conducted by calculating the Hamming distances between the codes of available data examples and the query and selecting data examples within small Hamming distances, which can be calculated using efficient bitwise operator XOR. Locality-Sensitive Hashing (LSH) [1] is one of the most commonly used data-independent hashing methods. It utilizes random linear projections, which are independent of training data, to map data points from a highdimensional feature space to a low-dimensional binary space. Another class of hashing methods are called datadependent methods, whose projection functions are learned from training data. These data-dependent methods include spectral hashing (SH) [9], principal component analysis based hashing (PCAH) [4], self-taught hashing (STH) [10] and iterative quantization (ITQ) [3]. SH learns the hashing codes based on spectral graph partitioning and forcing the balanced and uncorrelated constraints into the learned codes. PCAH utilizes principal component analysis (PCA) to learn the projection functions. STH combines an unsupervised learning step with a supervised learning step to learn effective hashing codes. ITQ learns an orthogonal rotation matrix to refine the initial projection matrix learned by PCA so that the quantization error of mapping the data to binary codes is minimized. Compared with the data-independent methods, these data-dependent methods generally provide more effective hashing codes. Hashing methods generate promising results by successfully addressing the storage and search efficiency challenges. However, most existing hashing methods ignore the hidden semantic structure of documents but only learns hashing codes using original features (i.e., tf-idf). In document

retrieval, the hidden semantics usually reflect the true meanings/categories of a document. It is more desirable to find those documents that share same semantics instead of keywords to a query. In other words, the semantic captures the hidden information contained in a document and thus can better represent documents than original keyword features. Therefore, it is important to design hashing method that preserve the semantic structure among documents in the learned Hamming space. This paper proposes a novel Sparse Semantic Hashing (SpSH) approach that explores the hidden semantic representation of documents in learning their corresponding hashing codes. In particular, a unified framework is designed for ensuring the hidden semantic structure among the documents by a sparse coding model, while at the same time preserving the document similarity using graph Laplacian. An iterative coordinate descent procedure is then proposed for solving the optimization problem. Extensive experiments on two large scale datasets demonstrate the superior performance of the proposed research over several state-of-the-art hashing methods.

2.

SPARSE SEMANTIC HASHING

This section first states the problem setting of SpSH. Assume there are total n training data examples, denoted as: X = {x1 , x2 , . . . , xn } ∈ R d×n , where d is the dimensionality of the feature. The main purpose of SpSH is to map these training examples to the optimal binary hashing codes Y = {y1 , y2 , . . . , yn } ∈ {0, 1}k×n through a hashing function f : R d → {0, 1}k , such that the similarities among data examples in original feature space are preserved in the hashing codes . Here k is the number of hashing bits and yj = f (xj ).

2.1

Problem Formulation

The proposed SpSH approach is a general learning framework that consists of two stages. In the first stage, the hashing codes are learned in a unified framework by simultaneously learning the hidden semantic representation of documents and preserving the document similarity. In particular, the objective function of SpSH is composed of two components: (1) Semantic representation component, which ensures that the hashing codes are consistent with hidden semantics via a sparse coding model [2]; (2) Similarity preservation component, which aims at preserving the document similarity in the learned hashing codes. An iterative algorithm is then derived based on the objective function using a coordinate descent optimization procedure. In the second stage, the hashing function is learned with respect to the hashing codes for training documents.

2.1.1

code. Then the sparse semantic reconstruction term can be written as: X − B Y k2F + αkB B k2F + γkY Y k1 kX

here kkF is the matrix Frobenius norm. is introduced Y k1 is the sparsity constraint. α and γ to avoid overfitting. kY are the weight parameters. Intuitively, we reconstruct each document in the corpus X using a small number of basis in B indicated by the hashing code, where a 1 in the code means the corresponding semantic is related to the document and a 0 means irrelevant semantic. By minimizing this term, the hidden semantic structure among the documents are preserved in the learned hashing codes.

2.1.2

Similarity Preservation

One of the key problems in hashing algorithms is similarity preserving, which indicates that similar documents should be mapped to similar hashing codes within a short Hamming distance. The Hamming distance between two binary codes yi and yj can be calculated as 41 kyi − yj k2 . To measure the similarity between documents represented by the binary hashing codes, one natural way is to minimize the weighted average Hamming distance as follows: X S ij kyi − yj k2 (2) i,j

Here, S is the similarity matrix which is calculated based on the document features. To meet the similarity preservation criterion, we seek to minimize this quantity, because it incurs a heavy penalty if two similar documents are mapped far away. There are many different ways to define the similarity matrix S . In this paper, we adopt the local similarity due to its nice property in many information retrieval applications [7, 10]. In particular, the corresponding similarities are 2 2 computed by Gaussian functions, i.e., S ij = e−kxi −xj k /σij , where σij is a scaling parameter. By introducing a P diagonal n × n matrix D , whose entries are given by D ii = n j=1 S ij , Eqn.1 can be rewritten as: Y (D D − S )Y Y T ) = tr(Y Y LY T ) tr(Y

(3)

where L is the graph Laplacian and tr() is the matrix trace. By minimizing this term, the similarity between different documents can be preserved in the learned hashing codes.

2.2

Optimization Algorithm

The entire objective function of the proposed SpSH combines the above two components as follows: X − B Y k2F + αkB B k2F + βtr(Y Y LY T ) + γkY Y k1 min kX B,Y

(4) s.t. Y ∈ {0, 1}k×n

Sparse Semantic Reconstruction

The goal of semantic reconstruction of documents is to learn a basis B ∈ R d×k and corresponding sparse codes such that input data can be well approximated/represented. Here we assume there are k hidden semantics, each represented by a column of basis B . For the k hashing bits of each document, if the document contains the j-th semantic, then its corresponding j-th bit should be 1, otherwise 0. In this way, the hashing code essentially represents the hidden semantics of the document. Since a document usually related to a small number of semantics, we impose a sparse constraint to ensure that there are few 1’s in the hashing

(1)

B k2F kB

2.2.1

Relaxation

Directly minimizing the objective function in Eqn.4 is intractable because of the discrete constraint. Therefore, we propose to relax this constraint to 0 ≤ Y ≤ 1 . However, even after the relaxation, the objective function is still difficult to optimize since Y and B are coupled together and it is nonconvex with respect to Y and B jointly. We propose to use a coordinate descent algorithm for solving this relaxed optimization problem by iteratively optimizing the objective with respect to Y and B . In particular, after initializing B ,

the relaxed problem can be solved by doing the following two steps iteratively until convergence. Step 1: Fix B , optimize w.r.t. Y : X − B Y k2F + βtr(Y Y LY T ) + γkY Y k1 min kX Y

(5)

The objective function is differentiable with respect to Y and the partial derivative of Eqn.5 can be calculated as: ∂

Eqn(5) B T X + 2B B T B Y + 2βY Y L + γ11 = −2B Y

(6)

With this obtained gradient, L-BFGS Quasi-Newton method is applied to solve this optimization problem. Step 2: Fix Y , solve for B : X − B Y k2F + αkB B k2F min kX B

(7)

We can obtain the close form solution of B as: Y Y T + αII )−1 B = X Y T (Y

(8)

By solving Eqns.5 and 7 iteratively, the optimal values of Y and B can be obtained.

2.2.2

Binarization

After obtaining the optimal solution for the relaxed problem, we need to binarize them to obtain binary hashing codes that satisfy the relaxed constraints. The binary hashing codes for the training set can be obtained by thresholding Y . It was pointed out in [4] and [7] that desired hashing codes should also maximize the entropy to ensure efficiency. Following the maximum entropy principle, a binary bit that gives balanced partitioning of the whole dataset should provides maximum information. Therefore, we set the threshold for binarizing the p-th bit to be the median of y p . In particular, if p-th bit of yj is larger than median value, yjp is set to 1, otherwise yjp is set to 0. In this way, the binary code achieves the best balance.

2.2.3

Hashing Function

A linear hashing function is utilized to map documents to the binary hashing codes as: yj = f (xj ) = H xj

(9)

where H is a k × d parameter matrix representing the hashing function. Then the optimal hashing function can Y − HX be obtained by minimizing kY HXk2 .

3. 3.1

EXPERIMENTS Datasets and Implementation

Two text datasets are used in our experiments. ReutersV 11 dataset contains over 800,000 manually categorized newswire stories. A subset of 365001 documents of ReutersV1 is used in our experiment. 328501 documents are randomly selected as the training data, while the remaining 36500 documents are used as testing queries. 20N ewsgroups2 corpus is collected and originally used for document categorization. We use the popular ‘18828’ version which contains 18828 documents. 16946 documents are randomly chosen for training and the rest 1882 1 2

http://www.daviddlewis.com/resources/text/rcv1/ http://people.csail.mit.edu/jrennie/20Newsgroups/

Figure 1: Precision results on two datasets with different hashing bits. (a)-(b): Precision of the top 100 retrieved examples using Hamming Ranking. (c)(d): Precision within Hamming radius 2 using Hash Lookup.

documents are used for testing. tf -idf features are used to represent the documents. The parameters α, β and γ are tuned by cross validation on the training set. The number of nearest neighbors is fixed to be 7 when constructing the graph Laplacian for all experiments. The source codes of LSH, PCAH, SH, STH and ITQ provided by the authors are used in our experiments.

3.2

Evaluation Method

The search results are evaluated based on the groundtruth labels. We use several metrics to measure the performance of different methods. For evaluation with Hamming Ranking, we calculate the precision at top k that is the percentage of relevant neighbors among the top k returned examples, where we set k to be 100 in the experiments. For evaluation with Hash Lookup, all the examples within a fixed Hamming distance, r, of the query are evaluated. In particular, following [5] and [9], a Hamming distance r = 2 is used to retrieve the neighbors in the case of Hash Lookup. The precision of the returned examples falling within Hamming distance 2 is reported.

3.3

Results and Discussion

The proposed SpSH approach is compared with five different methods, i.e., Spectral Hashing (SH) [9], PCA Hashing (PCAH) [4], Latent Semantic Hashing (LSH) [1], Self Taught Hashing (STH) [10] and Iterative Quantization (ITQ) [3]. We evaluate the performance of different methods by varying the number of hashing bits in the range of {8, 16, 32, 64, 128}. Three sets of experiments are conducted on both datasets to evaluate the performance of SpSH. In the first set of experiments, we report the precision values for the top 100

Methods SpSH ITQ [3] STH [10] SH [9] PCAH [4] LSH [1]

Figure 2: Precision-Recall behavior on two datasets with 32 hashing bits. retrieved examples in Fig.1(a)-(b). The precision values for retrieved examples with Hamming distance 2 are reported in Fig.1(c)-(d). From these comparison results, we can see that SpSH achieves the best performance among all compared hashing methods on both datasets. We also observe from Fig.1(c)-(d) that the precisions of Hash Lookup decrease significantly with the increasing number of hashing bits. This is because when using longer hashing bits, the Hamming space becomes increasingly sparse and very few data points fall within the Hamming ball with radius 2, resulting in many 0 precision queries. However, the precision values of SpSH are still consistently higher than other methods. In the second set of experiments, the precision-recall curves with 32 hashing bits on both datasets are reported in Fig.2. It is clear that among all of these comparison methods, SpSH shows the best performance. From the reported figures, we can see that LSH does not perform well in most cases. This is because the LSH method is dataindependent and may lead to inefficient codes in practice. For SH and STH, although these methods try to preserve the similarity between data examples in their learned hashing codes, they do not model the hidden semantic structure among the documents while our SpSH learns a better sparse semantic representations for document corpus. ITQ achieves better performance than SH and STH since it somehow tries to minimize the quantization errors. However, different from these methods, the proposed SpSH learns the optimal hashing codes and hidden semantic basis jointly to better represent the documents and thus achieves better hashing performance. The third set of experiments study the training cost for learning hashing function and testing cost for encoding each query. The results on both datasets with 32 bits is reported in Table 1. We can see from this table that the training cost of SpSH is around one hundred seconds, which is comparable with most of the other hashing methods and it is not slow in practice considering the complexity of training. The test time for SpSH is sufficiently fast especially when compared to the nonlinear hashing method SH. The reason is that it only needs linear projection and binarization to generate the hashing codes for queries.

4.

CONCLUSION

This paper proposes a novel sparse semantic hashing approach that explores the hidden semantic representation of documents in learning their corresponding hashing codes.

ReutersV 1 training testing 123.86 0.4x10−4 45.34 0.4x10−4 76.39 0.4x10−4 58.37 3.6x10−4 23.17 0.4x10−4 2.24 0.4x10−4

20N ewsgroups training testing 74.84 0.5x10−4 11.19 0.5x10−4 48.77 0.5x10−4 16.23 3.9x10−4 8.18 0.5x10−4 2.21 0.5x10−4

Table 1: Training and testing time (in second) on two datasets with 32 hashing bits. A unified framework is designed for ensuring the hidden semantic structure among the documents by a sparse coding model, while at the same time preserving the document similarity using graph Laplacian. Extensive experiments on two datasets demonstrate the superior performance of the proposed research over several state-of-the-art hashing methods.

5.

ACKNOWLEDGMENTS

This work is partially supported by NSF research grants IIS-0746830, DRL-0822296, CNS-1012208, IIS-1017837, CNS-1314688 and a research grant from Office of Naval Research (ONR-11627465). This work is also partially supported by the Center for Science of Information (CSoI), an NSF Science and Technology Center, under grant agreement CCF-0939370.

6.

REFERENCES

[1] M. Datar, N. Immorlica, P. Indyk, and V. S. Mirrokni. Locality-sensitive hashing scheme based on p-stable distributions. In Symposium on Computational Geometry, pages 253–262, 2004. [2] S. Gao, I. W.-H. Tsang, L.-T. Chia, and P. Zhao. Local features are not lonely - laplacian sparse coding for image classification. In CVPR, pages 3555–3561, 2010. [3] Y. Gong, S. Lazebnik, A. Gordo, and F. Perronnin. Iterative quantization: A procrustean approach to learning binary codes for large-scale image retrieval. TPAMI, 2012. [4] R.-S. Lin, D. A. Ross, and J. Yagnik. Spec hashing: Similarity preserving algorithm for entropy-based coding. In CVPR, pages 848–854, 2010. [5] J. Wang, S. Kumar, and S.-F. Chang. Semi-supervised hashing for large-scale search. IEEE TPAMI, 34(12):2393–2406, 2012. [6] Q. Wang, L. Si, Z. Zhang, and N. Zhang. Active hashing with joint data example and tag selection. In SIGIR, 2014. [7] Q. Wang, D. Zhang, and L. Si. Semantic hashing using tags and topic modeling. In SIGIR, pages 213–222, 2013. [8] Q. Wang, D. Zhang, and L. Si. Weighted hashing for fast large scale similarity search. In CIKM, pages 1185–1188, 2013. [9] Y. Weiss, A. Torralba, and R. Fergus. Spectral hashing. In NIPS, pages 1753–1760, 2008. [10] D. Zhang, J. Wang, D. Cai, and J. Lu. Self-taught hashing for fast similarity search. In SIGIR, pages 18–25, 2010. [11] Q. Zhang, Y. Wu, Z. Ding, and X. Huang. Learning hash codes for efficient content reuse detection. In SIGIR, pages 405–414, 2012. [12] Z. Zhang, Q. Wang, L. Ruan, and L. Si. Preference preserving hashing for efficient recommendation. In SIGIR, 2014.

Sparse Semantic Hashing for Efficient Large Scale ...

Nov 7, 2014 - explosive growth of the internet, a huge amount of data have been ... its fast query speed and low storage cost. ..... The test time for SpSH is sufficiently fast especially when compared to the nonlinear hashing method SH. The reason is that it only needs linear projection and binarization to generate the.

2MB Sizes 2 Downloads 224 Views

Recommend Documents

Semi-Supervised Hashing for Large Scale Search - Semantic Scholar
Unsupervised methods design hash functions using unlabeled ...... Medical School, Harvard University in 2006. He ... stitute, Carnegie Mellon University.

Semi-Supervised Hashing for Large Scale Search - Sanjiv Kumar
Currently, he is a Research. Staff Member in the business analytics and ... worked in different advising/consulting capacities for industry research labs and ...

Semi-Supervised Hashing for Large Scale Search - Sanjiv Kumar
IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE, VOL. ...... and a soft assignment strategy was used for deriving the image.

Semantic Hashing -
Deep auto-encoder. Word count vector ... Training. • Pretraining: Mini-baches with 100 cases. • Greedy pretrained with 50 epochs. • The weights were initialized ...

Efficient Indexing for Large Scale Visual Search
local feature-based image retrieval systems, “bag of visual terms” (BOV) model is ... with the same data structure, and answer a query in a few milliseconds [2].

Deep Learning Methods for Efficient Large Scale Video Labeling
Jun 14, 2017 - We present a solution to “Google Cloud and YouTube-. 8M Video ..... 128 samples batch size) achieved private leaderboard GAP score of ...

cost-efficient dragonfly topology for large-scale ... - Research at Google
radix or degree increases, hop count and hence header ... 1. 10. 100. 1,000. 10,000. 1985 1990 1995 2000 2005 2010. Year .... IEEE CS Press, 2006, pp. 16-28.

Efficient Topologies for Large-scale Cluster ... - Research at Google
... to take advantage of additional packing locality and fewer optical links with ... digital systems – e.g., server clusters, internet routers, and storage-area networks.

LARGE SCALE NATURAL IMAGE ... - Semantic Scholar
1MOE-MS Key Lab of MCC, University of Science and Technology of China. 2Department of Electrical and Computer Engineering, National University of Singapore. 3Advanced ... million natural image database on different semantic levels defined based on Wo

Semantic Hashing -
Conjugate gradient for fine-tuning. • Reconstructing the code words. • Replacing the stochastic binary values of hidden units with probability. • Code layer close ...

Template Detection for Large Scale Search Engines - Semantic Scholar
web pages based on HTML tag . [3] employs the same partition method as [2]. Keywords of each block content are extracted to compute entropy for the.

LSH BANDING FOR LARGE-SCALE RETRIEVAL ... - Semantic Scholar
When combined with data-adaptive bin splitting (needed on only. 0.04% of the ..... tions and applications,” Data Mining and Knowledge Discovery,. 2008.

Efficient computation of large scale transfer ... - Mathematical Institute
Imag axis (rad/s). Figure 4: Pole-zero map of the 46 × 46 transfer matrix for disturbance channels. Circles denote the transfer function zeros and stars denote the ...

CloudRAMSort: fast and efficient large-scale distributed ...
May 24, 2012 - sorting of large-scale in-memory data of current and future systems. ... gation of tens to hundreds of commodity server processors. We carefully ...

Efficient Large Scale Integration Power/Ground ...
of delta-I, excessive IR drop and electromigration becomes the recent hot-topic in deep submicron VLSI designs [1],. [2]. Present P/G network design focuses on ...

Efficient computation of large scale transfer ... - Mathematical Institute
zeros can be computed as the dominant poles of the inverse transfer function by .... As the controller K is determined by the designer and is, in general, of small ...

Efficient Large-Scale Distributed Training of Conditional Maximum ...
computer vision [12] over the last decade or more. ..... online product, service, and merchant reviews with a three-label output (positive, negative .... Our analysis and experiments give significant support for the mixture weight method for training

on production infrastructure Efficient large-scale replica ... - GitHub
1. Introduction. Replica-exchange (RE) [1,2] methods have been used to understand physical ... the resources, network and other components are homogeneous. .... Manager, (ii) the BigJob-Agent, and (iii) the advert service which is a central.

Efficient Large-Scale Distributed Training of ... - Research at Google
Training conditional maximum entropy models on massive data sets requires sig- ..... where we used the convexity of Lz'm and Lzm . It is not hard to see that BW .... a large cluster of commodity machines with a local shared disk space and a.

Discrete Graph Hashing - Semantic Scholar
matrix trace norm, matrix Frobenius norm, l1 norm, and inner-product operator, respectively. Anchor Graphs. In the discrete graph hashing model, we need to ...

Towards Large Scale Reasoning on the Semantic Web
evaluate the performance of the DLog database extension. Keywords: ... for querying description logic concepts in an environment where the ABox is stored in a ..... The SQL query in the simple interface is defined using the string attribute.

Mining Large-scale Parallel Corpora from ... - Semantic Scholar
Multilingual data are critical resources for building many applications, such as machine translation (MT) and cross-lingual information retrieval. Many parallel ...