Starspace: Embed All the Things!

Starspace: Embed All the Things!

StarSpace: Embed All The Things! Ledell Wu, Adam Fisch, Sumit Chopra, Keith Adams, Antoine Bordes and Jason Weston Facebook AI Research Abstract hence the “star” (“*”, meaning all types) and “space” in the name, and in that common space compares them against We present StarSpace, a general-purpose neural embedding each other. It learns to rank a set of entities, documents or model that can solve a wide variety of problems: labeling tasks such as text classification, ranking tasks such as in- objects given a query entity, document or object, where the formation retrieval/web search, collaborative filtering-based query is not necessarily of the same type as the items in the or content-based recommendation, embedding of multi- set. relational graphs, and learning word, sentence or document We evaluate the quality of our approach on six different level embeddings. In each case the model works by embed- tasks, namely text classification, link prediction in knowl- ding those entities comprised of discrete features and com- edge bases, document recommendation, article search, sen- paring them against each other – learning similarities depen- tence matching and learning general sentence embeddings. dent on the task. Empirical results on a number of tasks show StarSpace is available as an open-source project at https: that StarSpace is highly competitive with existing methods, //github.com/facebookresearch/Starspace. whilst also being generally applicable to new cases where those methods are not. 2 Related Work Latent text representations, or embeddings, are vectorial rep- 1 Introduction resentations of words or documents, traditionally learned in We introduce StarSpace, a neural embedding model that is an unsupervised way over large corpora. Work on neural general enough to solve a wide variety of problems: embeddings in this domain includes (Bengio et al. 2003), • Text classification, or other labeling tasks, e.g. sentiment (Collobert et al. 2011), word2vec (Mikolov et al. 2013) and classification. more recently fastText (Bojanowski et al. 2017). In our ex- periments we compare to word2vec and fastText as repre- • Ranking of sets of entities, e.g. ranking web documents sentative scalable models for unsupervised embeddings; we given a query. also compare on the SentEval tasks (Conneau et al. 2017) • Collaborative filtering-based recommendation, e.g. rec- against a wide range of unsupervised models for sentence ommending documents, music or videos. embedding. • Content-based recommendation where content is defined In the domain of supervised embeddings, SSI (Bai et al. with discrete features, e.g. words of documents. 2009) and WSABIE (Weston, Bengio, and Usunier 2011) are early approaches that showed promise in NLP and infor- • Embedding graphs, e.g. multi-relational graphs such as mation retrieval tasks ((Weston et al. 2013), (Hermann et al. arXiv:1709.03856v5 [cs.CL] 21 Nov 2017 Freebase. 2014)).Several more recent works including (Tang, Qin, and • Learning word, sentence or document embeddings. Liu 2015), (Zhang and LeCun 2015), (Conneau et al. 2016), TagSpace (Weston, Chopra, and Adams 2014) and fastText StarSpace can be viewed as a straight-forward and effi- (Joulin et al. 2016) have yielded good results on classifica- cient strong baseline for any of these tasks. In experiments tion tasks such as sentiment analysis or hashtag prediction. it is shown to be on par with or outperforming several com- In the domain of recommendation, embedding models peting methods, whilst being generally applicable to cases have had a large degree of success, starting from SVD where many of those methods are not. (Goldberget al. 2001) and its improvementssuch as SVD++ The method works by learning entity embeddings with (Koren and Bell 2015), as well as a host of other tech- discrete feature representations from relations among collec- niques, e.g. (Rendle 2010; Lawrence and Urtasun 2009; tions of those entities directly for the task of ranking or clas- Shi et al. 2012). Many of those methods have focused on sification of interest. In the general case, StarSpace embeds the collaborative filtering setup where user IDs and movie entities of different types into a vectorial embedding space, IDs have individual embeddings, such as in the Netflix chal- Copyright c 2018, Association for the Advancement of Artificial lenge setup (see e.g., (Koren and Bell 2015), and so new Intelligence (www.aaai.org). All rights reserved. users or items cannot naturally be incorporated. We show how StarSpace can naturally cater for both that setting and • The similarity function sim(·, ·). In our system, we have the content-based setting where users and items are repre- implemented both cosine similarity and inner product, sented as features, and hence have natural out-of-sample ex- and selected the choice as a hyperparameter. Generally, tensions rather than considering only a fixed set. they work similarly well for small numbers of label fea- Performing link prediction in knowledge bases (KBs) tures (e.g. for classification), while cosine works better for with embedding-based methods has also shown promising larger numbers, e.g. for sentence or document similarity. results in recent years. A series of work has been done in • The loss function Lbatch that compares the positive pair this direction, such as (Bordes et al. 2013) and (Garcia- − (a,b) with the negative pairs (a,bi ), i = 1,...,k. We Duran, Bordes, and Usunier 2015). In our work, we show also implement two possibilities: margin ranking loss (i.e. that StarSpace can be used for this task as well, outperform- max(0,µ − sim(a,b), where µ is the margin parameter), ing several methods, and matching the TransE method pre- and negative log loss of softmax. All experiments use the sented in (Bordes et al. 2013). former as it performed on par or better. 3 Model We optimize by stochastic gradient descent (SGD), i.e., each SGD step is one sample from E+ in the outer sum, The StarSpace model consists of learning entities, each of using Adagrad (Duchi, Hazan, and Singer 2011) and hog- which is described by a set of discrete features (bag-of- wild (Recht et al. 2011) over multiple CPUs. We also apply features) coming from a fixed-length dictionary. An entity a max norm of the embeddingsto restrict the vectors learned such as a document or a sentence can be described by a bag to lie in a ball of radius r in space Rd, as in other works, e.g. of words or n-grams, an entity such as a user can be de- (Weston, Bengio, and Usunier 2011). scribed by the bag of documents, movies or items they have At test time, one can use the learned function sim(·, ·) to liked, and so forth. Importantly, the StarSpace model is free measure similarity between entities. For example, for classi- to compare entities of different kinds. For example, a user fication, a label is predicted at test time for a given input a entity can be compared with an item entity (recommenda- ˆ ˆ tion), or a document entity with label entities (text classifi- using maxˆb sim(a, b) over the set of possible labels b. Orin cation), and so on. This is done by learning to embed them general, for ranking one can sort entities by their similarity. in the same space such that comparisons are meaningful – Alternatively the embedding vectors can be used directly for by optimizing with respect to the metric of interest. some other downstream task, e.g., as is typically done with Denoting the dictionary of D features as F which is a D× word embedding models. However, if sim(·, ·) directly fits th the needs of your application, this is recommended as this is d matrix, where Fi indexes the i feature (row), yielding its d-dimensional embedding, we embed an entity a with the objective that StarSpace is trained to be good at. We now describe how this model can be applied to a wide Fi. Pi∈a variety of tasks, in each case describing how the generators That is, like other embedding models, our model starts by + − assigning a d-dimensional vector to each of the discrete fea- E and E work for that setting. tures in the set that we want to embed directly (which we call a dictionary, it can contain features like words, etc.). Multiclass Classification (e.g. Text Classification) The Entities comprised of features (such as documents) are rep- positive pair generator comes directly from a training set of resented by a bag-of-featuresof the features in the dictionary labeled data specifying (a,b) pairs where a are documents and their embeddings are learned implicitly. Note an entity (bags-of-words) and b are labels (singleton features). Nega- could consist of a single (unique) feature like a single word, tive entities b− are sampled from the set of possible labels. name or user or item ID if desired. To train our model, we need to learn to compare entities. Multilabel Classification In this case, each document a Specifically, we want to minimize the following loss func- can have multiple positive labels, one of them is sampled as tion: b at each SGD step to implement multilabel classification. batch − − X L (sim(a,b),sim(a,b1 ),...,sim(a,bk )) (a,b)∈E+ Collaborative Filtering-based Recommendation − − The b ∈E training data consists of a set of users, where each user is de- There are several ingredients to this recipe: scribed by a bag of items (described as unique features from • The generator of positive entity pairs (a,b) coming from the dictionary) that the user likes. The positive pair generator the set E+. This is task dependent and will be described picks a user, selects a to be the unique singleton feature for subsequently.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us