Book Image

Machine Learning Techniques for Text

By : Nikos Tsourakis
Book Image

Machine Learning Techniques for Text

By: Nikos Tsourakis

Overview of this book

With the ever-increasing demand for machine learning and programming professionals, it's prime time to invest in the field. This book will help you in this endeavor, focusing specifically on text data and human language by steering a middle path among the various textbooks that present complicated theoretical concepts or focus disproportionately on Python code. A good metaphor this work builds upon is the relationship between an experienced craftsperson and their trainee. Based on the current problem, the former picks a tool from the toolbox, explains its utility, and puts it into action. This approach will help you to identify at least one practical use for each method or technique presented. The content unfolds in ten chapters, each discussing one specific case study. For this reason, the book is solution-oriented. It's accompanied by Python code in the form of Jupyter notebooks to help you obtain hands-on experience. A recurring pattern in the chapters of this book is helping you get some intuition on the data and then implement and contrast various solutions. By the end of this book, you'll be able to understand and apply various techniques with Python for text preprocessing, text representation, dimensionality reduction, machine learning, language modeling, visualization, and evaluation.
Table of Contents (13 chapters)

Introducing logistic regression

Linear regression is well suited when predicting the value of a continuous numerical variable. Based on the assumption that there is a linear relationship between the dependent and the independent variable, the method aims to find the line of best fit and use it for prediction. In this chapter, however, we are dealing with a classification problem, as we need to assign a sentiment label (positive or negative) to a piece of text. Consequently, this is a different problem because the dependent variable is categorical and not numerical.

This section applies a supervised learning algorithm called logistic regression, which is suitable for binary classification problems. Notice that there is also the multinomial logistic regression algorithm option for multiclass problems. Logistic regression is a parametric learning algorithm that outputs a probability that an input belongs to a particular class. Instead of fitting a straight line to the data, the effort...