Loading tutorials
fit and transform in scikit-learn. Tokenization is the first step in turning text into a document-term matrix. Every later count, weight and similarity score depends on the tokens you choose here.3 min readCountVectorizer once, and can read short NumPy and scikit-learn snippets.4 min readfit and predict. Earlier chapters covered tokenization, normalization and vocabulary construction. Here we use them to turn documents into rows of counts.4 min readfit and predict mean for a classifier, and have seen the earlier chapters on tokenization, normalization, vocabulary construction, and bag of words. Here we assemble those pieces into the object every later chapter uses: the doc5 min readCountVectorizer, and you should be comfortable with NumPy arrays and natural logarithms.4 min readln (the natural logarithm), and with NumPy arrays. Here you combine the two ideas into one weight, compute it by hand, an5 min readTfidfVectorizer once. It explains the last step of the TF-IDF recipe: scaling each document vector to length 1.4 min readfit and predict on a scikit-learn estimator. Here the focus is on how scikit-learn's two vectorizers implement those id4 min readgood. An n-gram is a run of n consecutive tokens. If you add n-grams to the vocabulary, the model gets features for short phrases and recovers a little of the word order that counting throws away. This ch5 min readCountVectorizer and TfidfVectorizer and know what a document-term matrix is. It covers how to shrink the vocabulary on purpose, which settings do it, and what can go wrong.4 min readTfidfVectorizer, including L2 row normalization. Here you will turn those row vectors into a similarity score between documents and use it for ranking and search.4 min readTfidfVectorizer and CountVectorizer, know what a train/test split is, and have seen a scikit-learn fit and predict call. You will learn what a vectorizer learns during fit, why it must learn that only from training text, and how a pipeline enforces the rule4 min readCountVectorizer and TfidfVectorizer, how a document-term matrix is stored as a sparse matrix, and how fit and predict work in a scikit-learn pipeline. You also need to be comfortable with modulo arithmetic.4 min readCountVectorizer and TfidfVectorizer features, read a sparse document-term matrix, and compare vectors with cosine similarity. It explains where those features fail, how to spot each failure, and what to use when they do.4 min read