𝔖 Scriptorium
✦   LIBER   ✦

πŸ“

Supervised Machine Learning for Text Analysis in R (Chapman & Hall/CRC Data Science Series)

✍ Scribed by Emil Hvitfeldt, Julia Silge


Publisher
Chapman and Hall/CRC
Year
2021
Tongue
English
Leaves
402
Edition
1
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Text data is important for many domains, from healthcare to marketing to the digital humanities, but specialized approaches are necessary to create features for machine learning from language. Supervised Machine Learning for Text Analysis in R explains how to preprocess text data for modeling, train models, and evaluate model performance using tools from the tidyverse and tidymodels ecosystem. Models like these can be used to make predictions for new observations, to understand what natural language features or characteristics contribute to differences in the output, and more. If you are already familiar with the basics of predictive modeling, use the comprehensive, detailed examples in this book to extend your skills to the domain of natural language processing.

This book provides practical guidance and directly applicable knowledge for data scientists and analysts who want to integrate unstructured text data into their modeling pipelines. Learn how to use text data for both regression and classification tasks, and how to apply more straightforward algorithms like regularized regression or support vector machines as well as deep learning approaches. Natural language must be dramatically transformed to be ready for computation, so we explore typical text preprocessing and feature engineering steps like tokenization and word embeddings from the ground up. These steps influence model results in ways we can measure, both in terms of model metrics and other tangible consequences such as how fair or appropriate model results are.β€―

✦ Table of Contents


Cover
Half Title
Title Page
Copyright Page
Dedication
Contents
Preface
I. Natural Language Features
1. Language and modeling
1.1. Linguistics for text analysis
1.2. A glimpse into one area: morphology
1.3. Different languages
1.4. Other ways text can vary
1.5. Summary
1.5.1. In this chapter, you learned:
2. Tokenization
2.1. What is a token?
2.2. Types of tokens
2.2.1. Character tokens
2.2.2. Word tokens
2.2.3. Tokenizing by n-grams
2.2.4. Lines, sentence, and paragraph tokens
2.3. Where does tokenization break down?
2.4. Building your own tokenizer
2.4.1. Tokenize to characters, only keeping letters
2.4.2. Allow for hyphenated words
2.4.3. Wrapping it in a function
2.5. Tokenization for non-Latin alphabets
2.6. Tokenization benchmark
2.7. Summary
2.7.1. In this chapter, you learned:
3. Stop words
3.1. Using premade stop word lists
3.1.1. Stop word removal in R
3.2. Creating your own stop words list
3.3. All stop word lists are context-specific
3.4. What happens when you remove stop words
3.5. Stop words in languages other than English
3.6. Summary
3.6.1. In this chapter, you learned:
4. Stemming
4.1. How to stem text in R
4.2. Should you use stemming at all?
4.3. Understand a stemming algorithm
4.4. Handling punctuation when stemming
4.5. Compare some stemming options
4.6. Lemmatization and stemming
4.7. Stemming and stop words
4.8. Summary
4.8.1. In this chapter, you learned:
5. Word Embeddings
5.1. Motivating embeddings for sparse, high-dimensional
5.2. Understand word embeddings by finding them yourself
5.3. Exploring CFPB word embeddings
5.4. Use pre-trained word embeddings
5.5. Fairness and word embeddings
5.6. Using word embeddings in the real world
5.7. Summary
5.7.1. In this chapter, you learned:
II. Machine Learning Methods
Overview
6. Regression
6.1. A first regression model
6.1.1. Building our first regression model
6.1.2. Evaluation
6.2. Compare to the null model
6.3. Compare to a random forest model
6.4. Case study: removing stop words
6.5. Case study: varying n-grams
6.6. Case study: lemmatization
6.7. Case study: feature hashing
6.7.1. Text normalization
6.8. What evaluation metrics are appropriate?
6.9. The full game: regression
6.9.1. Preprocess the data
6.9.2. Specify the model
6.9.3. Tune the model
6.9.4. Evaluate the modeling
6.10. Summary
6.10.1. In this chapter, you learned:
7. Classification
7.1. A first classification model
7.1.1. Building our first classification model
7.1.2. Evaluation
7.2. Compare to the null model
7.3. Compare to a lasso classification model
7.4. Tuning lasso hyperparameters
7.5. Case study: sparse encoding
7.6. Two-class or multiclass?
7.7. Case study: including non-text data
7.8. Case study: data censoring
7.9. Case study: custom features
7.9.1. Detect credit cards
7.9.2. Calculate percentage censoring
7.9.3. Detect monetary amounts
7.10. What evaluation metrics are appropriate?
7.11. The full game: classification
7.11.1. Feature selection
7.11.2. Specify the model
7.11.3. Evaluate the modeling
7.12. Summary
7.12.1. In this chapter, you learned:
III. Deep Learning Methods
Overview
8. Dense neural networks
8.1. Kickstarter data
8.2. A first deep learning model
8.2.1. Preprocessing for deep learning
8.2.2. One-hot sequence embedding of text
8.2.3. Simple flattened dense network
8.2.4. Evaluation
8.3. Using bag-of-words features
8.4. Using pre-trained word embeddings
8.5. Cross-validation for deep learning models
8.6. Compare and evaluate DNN models
8.7. Limitations of deep learning
8.8. Summary
8.8.1. In this chapter, you learned:
9. Long short-term memory (LSTM) networks
9.1. A first LSTM model
9.1.1. Building an LSTM
9.1.2. Evaluation
9.2. Compare to a recurrent neural network
9.3. Case study: bidirectional LSTM
9.4. Case study: stacking LSTM layers
9.5. Case study: padding
9.6. Case study: training a regression model
9.7. Case study: vocabulary size
9.8. The full game: LSTM
9.8.1. Preprocess the data
9.8.2. Specify the model
9.9. Summary
9.9.1. In this chapter, you learned:
10. Convolutional neural networks
10.1. What are CNNs?
10.1.1. Kernel
10.1.2. Kernel size
10.2. A first CNN model
10.3. Case study: adding more layers
10.4. Case study: byte pair encoding
10.5. Case study: explainability with LIME
10.6. Case study: hyperparameter search
10.7. Cross-validation for evaluation
10.8. The full game: CNN
10.8.1. Preprocess the data
10.8.2. Specify the model
10.9. Summary
10.9.1. In this chapter, you learned:
IV. Conclusion
Text models in the real world
Appendix
A. Regular expressions
A.1. Literal characters
A.1.1. Meta characters
A.2. Full stop, the wildcard
A.3. Character classes
A.3.1. Shorthand character classes
A.4. Quantifiers
A.5. Anchors
A.6. Additional resources
B. Data
B.1. Hans Christian Andersen fairy tales
B.2. Opinions of the Supreme Court of the United States
B.3. Consumer Financial Protection Bureau (CFPB) complaints
B.4. Kickstarter campaign blurbs
C. Baseline linear classifier
C.1. Read in the data
C.2. Split into test/train and create resampling folds
C.3. Recipe for data preprocessing
C.4. Lasso regularized classification model
C.5. A model workflow
C.6. Tune the workflow
References
Index


πŸ“œ SIMILAR VOLUMES


Time Series for Data Science: Analysis a
✍ Wayne A. Woodward, Bivin Philip Sadler, Stephen Robertson πŸ“‚ Library πŸ“… 2022 πŸ› Chapman and Hall/CRC 🌐 English

<p><span>Data Science students and practitioners want to find a forecast that β€œworks” and don’t want to be constrained to a single forecasting strategy, </span><span>Time Series for Data Science: Analysis and Forecasting</span><span> discusses techniques of ensemble modelling for combining informati

Behavior Analysis with Machine Learning
✍ Enrique Garcia Ceja πŸ“‚ Library πŸ“… 2021 πŸ› Chapman and Hall/CRC 🌐 English

<p><b>Behavior Analysis with Machine Learning Using R </b>introduces machine learning and deep learning concepts and algorithms applied to a diverse set of behavior analysis problems. It focuses on the practical aspects of solving such problems based on data collected from sensors or stored in elect

R Programming for Bioinformatics (Chapma
✍ Robert Gentleman πŸ“‚ Library πŸ“… 2008 πŸ› Chapman and Hall/CRC 🌐 English

R itself is well equipped with documentation, which ships with every distribution of R and the R add-on packages. But a good overall picture, how R concrete is used in nowadays bioinformatics software development, was always missing. If you are interested in bioinformatics software developing, and

Basketball Data Science: With Applicatio
✍ Paola Zuccolotto, Marica Manisera πŸ“‚ Library πŸ“… 2020 πŸ› Chapman and Hall/CRC 🌐 English

<p>Using data from one season of NBA games, <strong>Basketball Data Science: With Applications in R</strong> is the perfect book for anyone interested in learning and applying data analytics in basketball. Whether assessing the spatial performance of an NBA player’s shots or doing an analysis of the

Modern Data Science with R (Chapman & Ha
✍ Benjamin S. Baumer, Daniel T. Kaplan, Nicholas J. Horton πŸ“‚ Library πŸ“… 2021 πŸ› Chapman and Hall/CRC 🌐 English

<p>From a review of the first edition: "<i>Modern Data Science with R</i>… is rich with examples and is guided by a strong narrative voice. What’s more, it presents an organizing framework that makes a convincing argument that data science is a course distinct from applied statistics" (<i>The Americ