Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
15 Math Concepts Every Data Scientist Should Know

You're reading from   15 Math Concepts Every Data Scientist Should Know Understand and learn how to apply the math behind data science algorithms

Arrow left icon
Product type Paperback
Published in Aug 2024
Publisher Packt
ISBN-13 9781837634187
Length 510 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
David Hoyle David Hoyle
Author Profile Icon David Hoyle
David Hoyle
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Part 1: Essential Concepts FREE CHAPTER
2. Chapter 1: Recap of Mathematical Notation and Terminology 3. Chapter 2: Random Variables and Probability Distributions 4. Chapter 3: Matrices and Linear Algebra 5. Chapter 4: Loss Functions and Optimization 6. Chapter 5: Probabilistic Modeling 7. Part 2: Intermediate Concepts
8. Chapter 6: Time Series and Forecasting 9. Chapter 7: Hypothesis Testing 10. Chapter 8: Model Complexity 11. Chapter 9: Function Decomposition 12. Chapter 10: Network Analysis 13. Part 3: Selected Advanced Concepts
14. Chapter 11: Dynamical Systems 15. Chapter 12: Kernel Methods 16. Chapter 13: Information Theory 17. Chapter 14: Non-Parametric Bayesian Methods 18. Chapter 15: Random Matrices 19. Index 20. Other Books You May Enjoy

Exercises

The following is a series of exercises. Answers to all the exercises are given in the Answers_to_Exercises_Chap14.ipynb Jupyter Notebook in the GitHub repository:

  1. The Matérn kernel function, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>k</mml:mi><mml:mfenced separators="|"><mml:mrow><mml:munder underaccent="false"><mml:mrow><mml:mi>x</mml:mi></mml:mrow><mml:mo>_</mml:mo></mml:munder><mml:mo>,</mml:mo><mml:munder underaccent="false"><mml:mrow><mml:mi>y</mml:mi></mml:mrow><mml:mo>_</mml:mo></mml:munder></mml:mrow></mml:mfenced></mml:math>, can be thought of as a generalization of the RBF kernel. It is of the following form:

<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow><mrow><mi>k</mi><mfenced open="(" close=")"><mrow><munder><mi>x</mi><mo stretchy="true">_</mo></munder><mo>,</mo><munder><mi>y</mi><mo stretchy="true">_</mo></munder></mrow></mfenced><mo>=</mo><mfrac><mn>1</mn><mrow><mi mathvariant="normal">Γ</mi><mfenced open="(" close=")"><mi>ν</mi></mfenced><msup><mn>2</mn><mrow><mi mathvariant="normal">ν</mi><mo>−</mo><mn>1</mn></mrow></msup></mrow></mfrac><msup><mfenced open="(" close=")"><mrow><mfrac><msqrt><mrow><mn>2</mn><mi>ν</mi></mrow></msqrt><mi>b</mi></mfrac><mo>|</mo><munder><mi>x</mi><mo stretchy="true">_</mo></munder><mo>−</mo><munder><mi>y</mi><mo stretchy="true">_</mo></munder><mo>|</mo></mrow></mfenced><mi mathvariant="normal">ν</mi></msup><msub><mi>K</mi><mi mathvariant="normal">ν</mi></msub><mfenced open="(" close=")"><mrow><mfrac><msqrt><mrow><mn>2</mn><mi>ν</mi></mrow></msqrt><mi mathvariant="normal">b</mi></mfrac><mo>|</mo><munder><mi>x</mi><mo stretchy="true">_</mo></munder><mo>−</mo><munder><mi>y</mi><mo stretchy="true">_</mo></munder><mo>|</mo></mrow></mfenced></mrow></mrow></math>

Eq. 29

<mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:msub><mml:mrow><mml:mi>K</mml:mi></mml:mrow><mml:mrow><mml:mi>ν</mml:mi></mml:mrow></mml:msub><mml:mfenced separators="|"><mml:mrow><mml:mi>z</mml:mi></mml:mrow></mml:mfenced></mml:math> is the modified Bessel function of the second kind. The Matérn kernel is specified by the parameters, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>ν</mml:mi></mml:math> and <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>b</mml:mi></mml:math>. The lengthscale parameter, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>b</mml:mi></mml:math>, plays a similar role to the length-scale parameter, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>b</mml:mi></mml:math>, in the RBF kernel in Eq. 10. The parameter, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>ν</mml:mi></mml:math>, controls how smooth the functions are when we use a GP prior with a Matérn covariance kernel.

Using the data from the code example in the main text and a Matérn kernel with the default value, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>ν</mml:mi><mml:mo>=</mml:mo><mml:mn>1.5</mml:mn></mml:math>, fit a GPR model to the data. Make predictions for a range of <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>x</mml:mi></mml:math> values. Note that for the Matérn kernel, the parameter, <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><mml:mi>ν</mml:mi></mml:math>, is not optimized by the scikit-learn fitting process, so if you instantiate a Matérn kernel...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime