ABSTRACT

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. 

part Part I|98 pages

Natural Language Features

chapter 21|6 pages

Language and modeling

chapter 2|28 pages

Tokenization

chapter 3|16 pages

Stop words

chapter 4|20 pages

Stemming

chapter 5|26 pages

Word Embeddings

part Part II|124 pages

Machine Learning Methods

chapter |5 pages

Overview

chapter 6|50 pages

Regression

chapter 7|68 pages

Classification

part Part III|120 pages

Deep Learning Methods

chapter |7 pages

Overview

chapter 8|42 pages

Dense neural networks

chapter 9|30 pages

Long short-term memory (LSTM) networks

chapter 10|40 pages

Convolutional neural networks

part Part IV|4 pages

Conclusion

chapter |3 pages

Text models in the real world