News for hackers. Stuff that matters.
Re:Word embeddings in 2017: Trends and future directions by PaulHoule on Saturday October 21, 2017 @05:41PM (#15523758)
My question is what are they really good for.

I mean king = queen -woman + man

That's the kind of thing we have ontologies for.

This article mentions that word embeddings are useful inside translators, but from the viewpoint of somebody who wants to extract meaning from text, what use is something that doesn't handle polysemy and phrases?

Re:Word embeddings in 2017: Trends and future directions by jph00 on Saturday October 21, 2017 @07:59PM (#15524303)
Word embeddings (or subword embeddings) are used for nearly all recent NLP algorithms, both shallow (e.g. FastText) and deep (e.g. Google Neural Translation). Unless you're using a basic bag-of-words approach, you need to translate your words into some vector format, so you probably want some kind of embeddings. In practice, all the state of the art approaches for translation, language modeling, classification (eg sentiment analysis), etc. all sit on top of embeddings.

It's not word embeddings job to handle phrases - but nearly all modern phrase embedding algorithms sit on top of word embeddings. They often create a weighted average of embeddings by using an attention model, or they can use a more complex model such as an LSTM with attention (e.g. CoVE - https://arxiv.org/abs/1708.00107 ).

Word embeddings can handle polysemy - high dimensional vectors can (and do) hold information of various types that is used in different contexts in different ways. Some approaches deal with this more directly (e.g. including part-of-speech as part of the vocab item), and that sometimes can help a bit.

Re:Word embeddings in 2017: Trends and future directions by PaulHoule on Saturday October 21, 2017 @08:22PM (#15524401)
Maybe I'm not reading it right, but that arXiv paper about CoVE doesn't seem to be getting anywhere near commercially useful results.

For instance, the random result for ImDB in Table 2 is 88.4 and the best one is 92.1; that's really not a lot of lift. I could see TREC-6 and TREC-50 results being good enough to let off the leash, but I still have a hard time picturing this being useful in the real world.

Re:Word embeddings in 2017: Trends and future directions by jph00 on Sunday October 22, 2017 @11:53AM (#15527317)
Oh BTW the "random" result means randomly initialized vectors. It's still using embeddings, just not pretraining
Re:Word embeddings in 2017: Trends and future directions by jph00 on Sunday October 22, 2017 @11:50AM (#15527307)
I have a version that gets 94.5 on IMDB although not published yet.
Re:Word embeddings in 2017: Trends and future directions by _pctq on Sunday October 22, 2017 @05:58AM (#15525954)
It's incredibly useful for search, given the property that similar words are close in the vectorial space. And given it's purely numbers, it's really fast to compute.

To see an example, type "fuel" in the search input on this page: https://openvoyce.com//products/quuu

You'll see many relevant results, none of them using the word "fuel". This is done purely with postgres, computing a L2 distance sort - no elasticsearch.

Re:Word embeddings in 2017: Trends and future directions by lacksconfidence on Sunday October 22, 2017 @11:21AM (#15527176)
Would you be willing to go into a little more detail about what this is actually doing?

What is the shape of the database? Do you normalize each document into a single vector which is compared, or are you keeping per-word vectors? I'm imagining you probably don't have a database with a row for every word, but maybe you do?

How do you pre-filter the list of documents to compute L2 for? If no pre-filtering, can this approach scale into millions of documents?

Re:Word embeddings in 2017: Trends and future directions by _pctq on Sunday October 22, 2017 @12:04PM (#15527409)
The main trick is to do an average of word embeddings in a given document, an idea I took from the youtube paper on recommendation engine [1].

I have a separated service that contains the word embeddings, generated with word2vec. The idea is to generate an embedding for the document by making an average of the embeddings of the words it contains, each having a coefficient based on the word's rarity (so, a rarer word has more weight than a stop word).

When saving a document, OpenVoyce is contacting this API and asks to generate an embedding for the document, then it only saves that in its own database (as a "cube" vector of 200 dimensions).

From there, searching for something new is just about asking for an embedding for the search terms and using `cube_distance()` [2] as sort function, it does not require pre-filtering since stop words are already weighted off (although, there is some filtering in the API as it ignores words it doesn't know).

It would still help to be able to define user specific stop words, though. For example, on Quuu's OpenVoyce, most suggestions are about adding new categories, so "category" should be considered a stop word, that's something I plan to implement.

I can't tell yet how it scales to million of records because we're very far from there for now (there are 4500+ suggestions and comments on OpenVoyce at present day). My bet is that if the amount of data becomes a problem, it may be fixed by reducing the number of dimensions of the vectors.

Oh, there's also something to know: the cube extension for postgres doesn't allow for more than 100 dimensions. This is something configurable, but only by editing a header file from the extension (that's the author's recommended method). I've detailed the problem and solution on my pg350d repos [3]

[1] https://static.googleusercontent.com/media/research.google.c...

[2] https://www.postgresql.org/docs/current/static/cube.html

[3] https://github.com/oelmekki/postgres-350d

Re:Word embeddings in 2017: Trends and future directions by PaulHoule on Monday October 23, 2017 @09:23AM (#15532975)
I think the results for "fuel" are incredibly bad. Sure, "Diesel" shows up, but so does "Essential Oils".

Have you done any evaluation to show that this is better than a more a conventional search engine? The Lesson of TREC is that 95% of the things that will "obviously" improve search results will not.

Re:Word embeddings in 2017: Trends and future directions by _pctq on Monday October 23, 2017 @05:31PM (#15537098)
The goal is not to not show a single bad result, it's to show the good results.
Re:Word embeddings in 2017: Trends and future directions by nl on Sunday October 22, 2017 @06:00AM (#15525961)
Word vectors are "useful" as an alternative representation for words in any machine learning task.

Previously one used TF-IDF to represent a document, but now one uses Word2Vec and will usually get better results.

For example, From Word Embeddings To Document Distances[1] shows how to use a new distance measure (Word Mover Distance) in classification tasks. This leads to state-of-the-art performance on 6 out of 8 classic text classification datasets (and very close on the other 2).

In most other practical NLP tasks you find similar results: replacing an older representation with a word embedding almost always improves performance.

[1] http://proceedings.mlr.press/v37/kusnerb15.pdf

Re:Word embeddings in 2017: Trends and future directions by gattilorenz on Sunday October 22, 2017 @04:26AM (#15525749)
Even if that example was the only use-case (it's not, they are used for word similarity, sentiment analysis and more...), word embeddings would still be useful, since creating ontologies is not Easy and takes time.

Somewhat unrelated, but the old joke goes: give one problem to two ontology experts, and they will come up with three different ontologies.