News for hackers. Stuff that matters.
Re:How to solve most NLP problems: a step-by-step guide by minimaxir on Wednesday January 24, 2018 @12:42PM (#16224585)
Word2Vec and bag-of-words/tf-idf are somewhat obsolete in 2018 for modeling. For classification tasks, fasttext (https://github.com/facebookresearch/fastText) performs better and faster.

Fasttext is also available in the popular NLP Python library gensim, with a good demo notebook: https://radimrehurek.com/gensim/models/fasttext.html

And of course, if you have a GPU, recurrent neural networks (or other deep learning architectures) are the endgame for the remaining 10% of problems (a good example is SpaCy's DL implementation: https://spacy.io/). Or use those libraries to incorporate fasttext for text encoding, which has worked well in my use cases.

Re:How to solve most NLP problems: a step-by-step guide by e_ameisen on Wednesday January 24, 2018 @01:28PM (#16225004)
Author here. One of the reasons to start with something even simpler than embeddings such as fastText/Word2Vec, is their ease of explainability. As this blog post alludes to, the majority of ML work is data work, and in order to efficiently work on your data, understanding what your model does right/wrong is critical. This is why we favor starting with approaches that might seem simple or outdated. Once you see how these approaches fail, you can better inform your choice of a complex model.
Re:How to solve most NLP problems: a step-by-step guide by KennyCason on Wednesday January 24, 2018 @02:59PM (#16225772)
Having worked on modeling data and sharing results with customers, I agree simpler solutions can be better for ease of explaining alone. Additionally, the loss of x percent accuracy with lower-tech solutions can sometimes be worth it because they are easier to train and reason with. This is particularly the case when you are just looking for loose directional indicators and correlations.

If simple solution gets 77% accuracy, and complex solution yields 80%, I would wager that most of the time you should just stick with the simple solution.

One specific example that comes to mind is in sentiment analysis where you can achieve "sufficiently" high accuracy with well tailored Bayesian approaches. They are super fast to train and reason with. If a customer/consumer wants to know exactly why a piece of text is positive or negative, the n-gram probability matrix is extremely easy to inspect. Subsequent re-training and fixing is also much easier than re-training a large neural network, svm, etc.

Re:How to solve most NLP problems: a step-by-step guide by kk58 on Thursday January 25, 2018 @01:48PM (#16233372)
Can you explain how you reduced sentences to 2 dimensional entities using PCA ?
Re:How to solve most NLP problems: a step-by-step guide by ilyaeck on Wednesday January 24, 2018 @01:18PM (#16224935)
First, FastText is very similar to (a superset of) Word2Vec. Secondly. RNNs are far from being endgame for anything. In fact, recent research has been moving away from them towards more predictable and parallelizable methods (see, e.g., Google's Transformers, aka "Attention is all you need", or FAIR's approach to translation using CNNs).
Re:How to solve most NLP problems: a step-by-step guide by minimaxir on Wednesday January 24, 2018 @01:37PM (#16225092)
Added a note about other DL architectures.
Re:How to solve most NLP problems: a step-by-step guide by mooneater on Wednesday January 24, 2018 @02:19PM (#16225477)
You may be painting with too broad a brush. I've worked with a number of NLP people to try to beat our tfidf model using deep methods and various word vectors. The tfidf still performs better. I think the reasons are: many out-of-vocab words, and small amounts of labelled data.
Re:How to solve most NLP problems: a step-by-step guide by PeterisP on Saturday February 03, 2018 @01:52PM (#16298918)
Coming a bit late to the discussion, but out-of-vocab words and small amounts of labelled data is the exact kind of problem that word embedding vectors are meant to solve, and they do so exceedingly well. Of course, you need a good, large source of (unlabelled) data, preferably approaching the gold standard of "everything that has ever been written about your problem domain" to train the embeddings, and that takes some effort, but then the out-of-vocab words must be exceedingly rare (i.e. only if it's a genuinely new word that has never ever been mentioned before, or a very very rare term that you've discarded), and even that can be solved well with character-based embeddings.
Re:How to solve most NLP problems: a step-by-step guide by artpar on Wednesday January 24, 2018 @01:21PM (#16224955)
I built a docker image exposing spacy.io (with their largest en model) as rest endpoints

http://github.com/artpar/languagecrunch

Re:How to solve most NLP problems: a step-by-step guide by taneq on Wednesday January 24, 2018 @12:53PM (#16224692)
I'm not an expert but I'd be surprised if you could declare any approach "endgame" at this point.
Re:How to solve most NLP problems: a step-by-step guide by sundarurfriend on Wednesday January 24, 2018 @12:55PM (#16224714)
My interpretation is that they meant something like "last resort" there.
Re:How to solve most NLP problems: a step-by-step guide by tanilama on Wednesday January 24, 2018 @12:56PM (#16224717)
Fasttext is not that different from word2vec
Re:How to solve most NLP problems: a step-by-step guide by crossroads091 on Wednesday January 24, 2018 @05:54PM (#16227120)
Fasttext's ability to handle OOVs, however naïve, cannot be understated. I'm not sure about the literature on this, but I think generalizing based on character-gram wordvectors is probably better than assigning a dropout based common OOV vector.
Re:How to solve most NLP problems: a step-by-step guide by tanilama on Wednesday January 24, 2018 @10:10PM (#16228450)
Evolution for sure, heck, they even has the same author. But fasttext is the same idea as word2vec, the objective is identical.
Re:How to solve most NLP problems: a step-by-step guide by Xeoncross on Wednesday January 24, 2018 @12:56PM (#16224727)
Reading the guide for fasttext I am not sure how a non NLP researcher would use it.

"This library can also be used to train supervised text classifiers" - https://github.com/facebookresearch/fastText#text-classifica...

Looks like you can use it for gensim. https://radimrehurek.com/gensim/models/fasttext.html

Re:How to solve most NLP problems: a step-by-step guide by sjg007 on Wednesday January 24, 2018 @03:09PM (#16225850)
You could probably throw DNA, RNA or protein sequences at it.
Re:How to solve most NLP problems: a step-by-step guide by Radim on Wednesday January 24, 2018 @03:47PM (#16226152)
A lot of people do. Here are the academic articles that cite Gensim and contain the word "protein" (4 pages of them):

https://scholar.google.com/scholar?hl=en&as_sdt=2005&cites=1...

Re:How to solve most NLP problems: a step-by-step guide by make3 on Thursday January 25, 2018 @12:47AM (#16229051)
I think you'd be surprised to find out that for a pretty large amount of classification problems, tf idf and Bayes naive classifiers do equally as good or almost as good but with less variance than deep nets.

also afaik fastext is just a faster way to build embeddings that are mostly equivalent to word2vec

All and all, I'm not sure you're enough of an expert to be commenting on this

Re:How to solve most NLP problems: a step-by-step guide by nl on Thursday January 25, 2018 @08:07AM (#16230529)
1) No, they don’t. Eg, on the current Toxic comment classification TF-IDF and Bayes models are about 20% worse than RNN models.

2) FastText is also a classification algorithm, a command line classifier and a set of pretrained embeddings.

3) Yes, he does. I’ve learnt from his notebooks before, and I am confident I’m qualified to judge. I don’t completely agree with his statement here, but he is well qualified to comment.

Re:How to solve most NLP problems: a step-by-step guide by make3 on Thursday January 25, 2018 @08:44AM (#16230681)
1) I'm saying, depends on the size of the datasets
Re:How to solve most NLP problems: a step-by-step guide by opportune on Wednesday January 24, 2018 @02:52PM (#16225724)
one of fasttext's main features is a pre-trained word2vec implementation, you can hardly call word2vec obsolete. Bag of words has been obsolete for a long time of course.

Yeah, fasttext/spacy/gensim are some of the biggest open source NLP libraries these days. However I've found that they aren't very performant - I've done prototyping in them before but wouldn't use them for a finished product. I'm sure most big tech companies use custom implementations to do their heavy lifting

Re:How to solve most NLP problems: a step-by-step guide by Radim on Wednesday January 24, 2018 @03:42PM (#16226118)
It's hard to quantify "most", but I can attest that some of the largest companies in the world do in fact use Gensim, in part because of its good performance and robust battle-tested implementations.
Re:How to solve most NLP problems: a step-by-step guide by opportune on Wednesday January 24, 2018 @03:55PM (#16226221)
I'm honored that you would respond to my comment! I meant that in no way as a dig against Gensim. Really I'm referring more to the pythonic environment itself - the larger an NLP application grows within Python, the more overhead baggage it picks up (due to logic written in Python - plus Cython is far from a silver bullet). That is not to mention all the difficulties involved in parallelization within a Python environment.

For what it's worth, when I was at a large company recently, I did use Gensim too - I was originally referring more to the case where you take a prototype for an NLP application and ask "ok, how do we scale this across millions of users"

Re:How to solve most NLP problems: a step-by-step guide by nl on Thursday January 25, 2018 @03:01AM (#16229478)
The Gensim version of FastText doesn’t support subword embeddings without additional support.

FastText itself (the command line program and the pretrained embeddings together) is a decent starting point for classification though.

Re:How to solve most NLP problems: a step-by-step guide by thomasahle on Thursday January 25, 2018 @04:10AM (#16229717)
The latest gensim does support fasttext .bin files and subwords (certainly using it with out of vocabulary words right now.) It doesn't support fasttext classification though.
Re:How to solve most NLP problems: a step-by-step guide by nl on Thursday January 25, 2018 @05:51AM (#16230063)
Oh that's awesome! I've been pre-processing and generating separate embedding files.
Re:How to solve most NLP problems: a step-by-step guide by fergie on Thursday January 25, 2018 @08:35AM (#16230636)
Bag-of-words/tf-idf is still a pretty good goto for working out "significant terms" to solve "search" tasks. Its simple, old, and reasonably effective, which is what makes it good.
Re:How to solve most NLP problems: a step-by-step guide by pilooch on Thursday January 25, 2018 @07:30AM (#16230370)
Fastext is faster but does not beat vdcnn and other deep architectures. It all depends on the use case really.
Re:How to solve most NLP problems: a step-by-step guide by losteric on Wednesday January 24, 2018 @01:18PM (#16224934)
When you say GPU + RNNs address the remaining 10% of problems... what problems fall under that 10%?
Re:How to solve most NLP problems: a step-by-step guide by minimaxir on Wednesday January 24, 2018 @01:30PM (#16225017)
In my case, problems where text is not the only input into the model (but the text is a highly-important feature), the text document is only a couple characters/words (or empty), and/or regressions instead of classifications. (although most of those are not specific to text encoding, but are difficult to implement and get good results without tools like Keras regardless)