Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Mastering NLP from Foundations to LLMs
Mastering NLP from Foundations to LLMs

Mastering NLP from Foundations to LLMs: Apply advanced rule-based techniques to LLMs and solve real-world business problems using Python

Arrow left icon
Profile Icon Gazit Profile Icon Meysam Ghaffari
Arrow right icon
₱1513.99 ₱2163.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9 (24 Ratings)
eBook Apr 2024 340 pages 1st Edition
eBook
₱1513.99 ₱2163.99
Paperback
₱1892.99 ₱2704.99
Subscription
Free Trial
Arrow left icon
Profile Icon Gazit Profile Icon Meysam Ghaffari
Arrow right icon
₱1513.99 ₱2163.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9 (24 Ratings)
eBook Apr 2024 340 pages 1st Edition
eBook
₱1513.99 ₱2163.99
Paperback
₱1892.99 ₱2704.99
Subscription
Free Trial
eBook
₱1513.99 ₱2163.99
Paperback
₱1892.99 ₱2704.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Mastering NLP from Foundations to LLMs

Mastering Linear Algebra, Probability, and Statistics for Machine Learning and NLP

Natural language processing (NLP) and machine learning (ML) are two fields that have significantly benefited from mathematical concepts, particularly linear algebra and probability theory. These fundamental tools enable the analysis of the relationships between variables, forming the basis of many NLP and ML models. This chapter provides a comprehensive introduction to linear algebra and probability theory, including their practical applications in NLP and ML. The chapter commences with an overview of vectors and matrices and covers essential operations. Additionally, the basics of statistics, required for understanding the concepts and models in subsequent chapters, will be explained. Finally, the chapter introduces the fundamentals of optimization, which are critical for solving NLP problems and understanding the relationships between variables. By the end of this chapter, you will have a solid foundation...

Introduction to linear algebra

Let’s start by first understanding scalars, vectors, and matrices:

  • Scalars: A scalar is a single numerical value that usually comes from the real domain in most ML applications. Examples of scalars in NLP include the frequency of a word in a text corpus.
  • Vectors: A vector is a collection of numerical elements. Each of these elements can be termed as an entry, component, or dimension, and the count of these components defines the vector’s dimensionality. Within NLP, a vector could hold components related to elements such as word frequency, sentiment ranking, and more. NLP and ML are two domains that have reaped substantial benefits from mathematical disciplines, particularly linear algebra and probability theory. These foundational tools aid in evaluating the correlation between variables and are at the heart of numerous NLP and ML models. This segment presents a detailed primer on linear algebra and probability theory, along...

Eigenvalues and eigenvectors

A vector x, belonging to a d × d matrix A, is an eigenvector if it satisfies the equation Ax = λx, where λ represents the eigenvalue associated with the matrix. This relationship delineates the link between matrix A and its corresponding eigenvector x, which can be perceived as the “stretching direction” of the matrix. In the case where A is a matrix that can be diagonalized, it can be deconstructed into a d × d invertible matrix, V, and a diagonal d × d matrix, Δ, such that

<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">A</mml:mi><mml:mi mathvariant="bold"> </mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="bold"> </mml:mi><mml:mi mathvariant="bold">V</mml:mi><mml:mi mathvariant="bold"> </mml:mi><mml:mi mathvariant="bold">Δ</mml:mi><mml:mi mathvariant="bold"> </mml:mi><mml:msup><mml:mrow><mml:mi mathvariant="bold">V</mml:mi></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup></mml:math>

The columns of V encompass d eigenvectors, while the diagonal entries of Δ house the corresponding eigenvalues. The linear transformation Ax can be visually understood through a sequence of three operations. Initially, the multiplication of x by <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:msup><mml:mrow><mml:mi mathvariant="bold">V</mml:mi></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup></mml:math> calculates x’s co-ordinates in a non-orthogonal basis associated with V’s columns. Subsequently, the multiplication of <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:msup><mml:mrow><mml:mi mathvariant="bold">V</mml:mi></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mn>1</mml:mn></mml:mrow></mml:msup></mml:math> x by Δ scales these co-ordinates using...

Basic probability for machine learning

Probability provides information about the likelihood of an event occurring. In this field, there are several key terms that are important to understand:

  • Trial or experiment: An action that results in a certain outcome with a certain likelihood
  • Sample space: This encompasses all potential outcomes of a given experiment
  • Event: This denotes a non-empty portion of the sample space

Therefore, in technical terms, probability is a measure of the likelihood of an event occurring when an experiment is conducted.

In this very simple case, the probability of event A with one outcome is equal to the chance of event A divided by the chance of all possible events. For example, in flipping a fair coin, there are two outcomes with the same chance: heads and tails. The chance of having heads will be 1/(1+1) = ½.

In order to calculate the probability, given an event, A, with n outcomes and a sample space, S, the probability of...

Summary

This chapter was about linear algebra and probability for ML, and it covers the fundamental mathematical concepts that are essential to understanding many machine learning algorithms. The chapter began with a review of linear algebra, covering topics such as matrix multiplication, determinants, eigenvectors, and eigenvalues. It then moved on to discuss probability theory, introducing the basic concepts of random variables and probability distributions. We also covered key concepts in statistical inference, such as maximum likelihood estimation and Bayesian inference.

In the next chapter, we will cover the fundamentals of machine learning for NLP, including topics such as data exploration, feature engineering, selection methods, and model training and validation.

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...

References

  • Alter O, Brown PO, Botstein D. (2000) Singular value decomposition for genome-wide expression data processing and modeling. Proc Natl Acad Sci U S A, 97, 10101-6.
  • Golub, G.H., and Van Loan, C.F. (1989) Matrix Computations, 2nd ed. (Baltimore: Johns Hopkins University Press).
  • Greenberg, M. (2001) Differential equations & Linear algebra (Upper Saddle River, N.J. : Prentice Hall).
  • Strang, G. (1998) Introduction to linear algebra (Wellesley, MA : Wellesley-Cambridge Press).
  • Lax, Peter D. Linear algebra and its applications. Vol. 78. John Wiley & Sons, 2007.
  • Dangeti, Pratap. Statistics for machine learning. Packt Publishing Ltd, 2017.
  • DasGupta, Anirban. Probability for statistics and machine learning: fundamentals and advanced topics. New York: Springer, 2011.
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn how to build Python-driven solutions with a focus on NLP, LLMs, RAGs, and GPT
  • Master embedding techniques and machine learning principles for real-world applications
  • Understand the mathematical foundations of NLP and deep learning designs
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

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.

Who is this book for?

This book is for deep learning and machine learning researchers, NLP practitioners, ML/NLP educators, and STEM students. Professionals working with text data as part of their projects will also find plenty of useful information in this book. Beginner-level familiarity with machine learning and a basic working knowledge of Python will help you get the best out of this book.

What you will learn

  • Master the mathematical foundations of machine learning and NLP Implement advanced techniques for preprocessing text data and analysis Design ML-NLP systems in Python
  • Model and classify text using traditional machine learning and deep learning methods
  • Understand the theory and design of LLMs and their implementation for various applications in AI
  • Explore NLP insights, trends, and expert opinions on its future direction and potential

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 26, 2024
Length: 340 pages
Edition : 1st
Language : English
ISBN-13 : 9781804616383
Category :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Apr 26, 2024
Length: 340 pages
Edition : 1st
Language : English
ISBN-13 : 9781804616383
Category :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 5,923.97 8,063.97 2,140.00 saved
Building LLM Powered  Applications
₱1785.99 ₱2551.99
Mastering NLP from Foundations to LLMs
₱1892.99 ₱2704.99
Transformers for Natural Language Processing and Computer Vision
₱2244.99 ₱2806.99
Total 5,923.97 8,063.97 2,140.00 saved Stars icon

Table of Contents

13 Chapters
Chapter 1: Navigating the NLP Landscape: A Comprehensive Introduction Chevron down icon Chevron up icon
Chapter 2: Mastering Linear Algebra, Probability, and Statistics for Machine Learning and NLP Chevron down icon Chevron up icon
Chapter 3: Unleashing Machine Learning Potentials in Natural Language Processing Chevron down icon Chevron up icon
Chapter 4: Streamlining Text Preprocessing Techniques for Optimal NLP Performance Chevron down icon Chevron up icon
Chapter 5: Empowering Text Classification: Leveraging Traditional Machine Learning Techniques Chevron down icon Chevron up icon
Chapter 6: Text Classification Reimagined: Delving Deep into Deep Learning Language Models Chevron down icon Chevron up icon
Chapter 7: Demystifying Large Language Models: Theory, Design, and Langchain Implementation Chevron down icon Chevron up icon
Chapter 8: Accessing the Power of Large Language Models: Advanced Setup and Integration with RAG Chevron down icon Chevron up icon
Chapter 9: Exploring the Frontiers: Advanced Applications and Innovations Driven by LLMs Chevron down icon Chevron up icon
Chapter 10: Riding the Wave: Analyzing Past, Present, and Future Trends Shaped by LLMs and AI Chevron down icon Chevron up icon
Chapter 11: Exclusive Industry Insights: Perspectives and Predictions from World Class Experts Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Most Recent
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9
(24 Ratings)
5 star 95.8%
4 star 0%
3 star 0%
2 star 4.2%
1 star 0%
Filter icon Filter
Most Recent

Filter reviews by




Sarbjit Singh Hanjra Oct 18, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
"Mastering NLP from Foundations to LLMs", serves as that crucial guide, helping readers chart their course through the expansive field of Natural Language Processing (NLP).From the basics of NLP and machine learning to advanced topics like neural networks, transformers, and LLMs, this book lays out the landscape clearly. It begins by grounding readers in essential mathematical concepts, including linear algebra and probability, before guiding them through data exploration and machine learning models. The book’s strength lies in its structured approach, making even the most complex topics—like text preprocessing, hyperparameter tuning, and ensemble models—easy to digest.The sections dedicated to LLMs are like detailed flight maps for advanced NLP techniques. From designing and integrating LLMs with LangChain and RAG to practical applications using Hugging Face, the book ensures you're well-equipped to navigate these models effectively. Highly recommended for those looking to master NLP, this guide is the perfect roadmap to understanding and leveraging the power of LLMs.
Amazon Verified review Amazon
Elad Jun 25, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book breaks down complex concepts into bite-sized, understandable pieces.I need to get up to speed with GenAI and this is my 3rd book so far.The python examples are super handy, making it easy to follow along and try things out myself. It's been a great way to up my coding game and dive into NLP. Highly recommend for someone looking to expand their programming skills.
Amazon Verified review Amazon
Petar Dimov Jun 21, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
🎉 This comprehensive guide has proved itself to be an invaluable resource!💡 The book captivated me from the first chapter itself. It brilliantly paves the way for everyone from budding learners to industry veterans in the space of NLP and LLMs, and its concise yet comprehensive coverage aligns perfectly with the needs of a wide array of readers.🧠 Gazit and Ghaffari have meticulously crafted this book as a powerful compendium of knowledge. They have intelligently structured the content to segue from fundamental understanding of topics like linear algebra, probability, and statistics to more advanced ML techniques, making it an essential manual of NLP-related learnings.✏️ What sets this book apart is not merely the actionable insight it provides, but how it beautifully combines these insights with real-life applications. The transition from text pre-processing techniques to deep learning models, discussed from Chapter 4 through 6, is skillfully supplemented with Python-based case studies, creating a truly immersive learning experience.🛠 For those fascinated by Large Language Models (LLMs), Chapters 7 to 9 delve into everything from theory and design to sophisticated applications like prompt engineering and RAGs, all of which are brought to life through practical code implementations.🧩 The final chapters (10 and 11) critically analyse the current trends influenced by AI and LLMs, while also making well-researched predictions about the future of this industry, preparing readers to stay ahead of the curve.✨ In summary, "Mastering NLP from Foundations to LLMs" is more than just a book; it is a well-rounded guide for anyone keen to tap into the potential of NLP and LLMs. This guide offers an impressive mix of foundational theories, actionable insights, and future forecasts, all while ensuring reader-friendly delivery. Whether you're a beginner or a professional, this book is a brilliant tool to navigate the complex yet exciting world of AI and LLMs.
Amazon Verified review Amazon
Lina Kaminski Jun 21, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I just finished, so 4 weeks for me.The authors cover everything from fundamental math and essential coding practices to advanced NLP techniques and large language models. They posted practical Python examples and real-world applications on Github so it was easy to spin up the pipeline.The book provides a thorough understanding and hands-on skills that are crucial for professionals. It's a perfect companion for anyone looking to excel in the rapidly evolving field of NLP.
Amazon Verified review Amazon
TD59 Jun 08, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I recommend this book as a great primer for NLP and the latest developments, especially in Large language Models. The book is easy to read, and it explains the key concepts clearly.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.