Book Image

Mastering NLP from Foundations to LLMs

By : Lior Gazit, Meysam Ghaffari
Book Image

Mastering NLP from Foundations to LLMs

By: Lior Gazit, Meysam Ghaffari

Overview of this book

Do you want to master Natural Language Processing (NLP) but don’t know where to begin? This book will give you the right head start. Written by leaders in machine learning and NLP, Mastering NLP from Foundations to LLMs provides an in-depth introduction to techniques. Starting with the mathematical foundations of machine learning (ML), you’ll gradually progress to advanced NLP applications such as large language models (LLMs) and AI applications. You’ll get to grips with linear algebra, optimization, probability, and statistics, which are essential for understanding and implementing machine learning and NLP algorithms. You’ll also explore general machine learning techniques and find out how they relate to NLP. Next, you’ll learn how to preprocess text data, explore methods for cleaning and preparing text for analysis, and understand how to do text classification. You’ll get all of this and more along with complete Python code samples. By the end of the book, the advanced topics of LLMs’ theory, design, and applications will be discussed along with the future trends in NLP, which will feature expert opinions. You’ll also get to strengthen your practical skills by working on sample real-world NLP business problems and solutions.
Table of Contents (14 chapters)

Further reading

Please find the additional reading content as follows:

  • Householder reflection matrix: A Householder reflection matrix, or Householder matrix, is a type of linear transformation utilized in numerical linear algebra due to its computational effectiveness and numerical stability. This matrix is used to perform reflections of a given vector about a plane or hyperplane, transforming the vector so that it only has non-0 components in one specific dimension. The Householder matrix (H) is defined by

<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" display="block"><mml:mi mathvariant="bold">H</mml:mi><mml:mi mathvariant="bold"> </mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="bold"> </mml:mi><mml:mi mathvariant="bold">I</mml:mi><mml:mi mathvariant="bold"> </mml:mi><mml:mo>-</mml:mo><mml:mi mathvariant="bold"> </mml:mi><mml:mn>2</mml:mn><mml:mi mathvariant="bold"> </mml:mi><mml:mi mathvariant="bold">u</mml:mi><mml:mi mathvariant="bold"> </mml:mi><mml:msup><mml:mrow><mml:mi mathvariant="bold">u</mml:mi></mml:mrow><mml:mrow><mml:mi>T</mml:mi></mml:mrow></mml:msup></mml:math>

Here, I is the identity matrix, and u is a unit vector defining the reflection plane.

The main purpose of Householder transformations is to perform QR factorization and to reduce matrices to a tridiagonal or Hessenberg form. The properties of being symmetric and orthogonal make the Householder matrix computationally efficient and numerically stable.

  • Diagonalizable: A matrix is said to be diagonalizable if it can be written in the form <math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mi mathvariant="bold">D</mi><mo>=</mo><msup><mi mathvariant="bold">P</mi><mrow><mo>−</mo><mn>1</mn></mrow></msup><mi mathvariant="bold">A</mi><mi mathvariant="bold">P</mi></mrow></mrow></math><math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mrow><mi mathvariant="bold">D</mi><mo>=</mo><msup><mi mathvariant="bold">P</mi><mrow><mo>−</mo><mn>1</mn></mrow></msup><mi mathvariant="bold">A</mi><mi mathvariant="bold">P</mi></mrow></mrow></math>, where A is the...