Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning Quick Reference

You're reading from  Machine Learning Quick Reference

Product type Book
Published in Jan 2019
Publisher Packt
ISBN-13 9781788830577
Pages 294 pages
Edition 1st Edition
Languages
Author (1):
Rahul Kumar Rahul Kumar
Profile icon Rahul Kumar
Toc

Table of Contents (18) Chapters close

Title Page
Copyright and Credits
About Packt
Contributors
Preface
1. Quantifying Learning Algorithms 2. Evaluating Kernel Learning 3. Performance in Ensemble Learning 4. Training Neural Networks 5. Time Series Analysis 6. Natural Language Processing 7. Temporal and Sequential Pattern Discovery 8. Probabilistic Graphical Models 9. Selected Topics in Deep Learning 10. Causal Inference 11. Advanced Methods 1. Other Books You May Enjoy Index

Kernel types


We're going to explain the types of in this section.

Linear kernel

Let's say there are two vectors, x1 and x2, so the linear kernel can be defined by the following:

K(x1, x2)= x1 . x2

Polynomial kernel

If there are two vectors, x1 and x2, the linear kernel can be defined by the following:

K(x1, x2)= (x1 . x+ c)d

Where:

  • c: Constant
  • d: Degree of polynomial:
def polynomial_kernel(x1, x2, degree, constant=0): 
    result = sum([x1[i] * x2[i] for i in range(len(x1))]) + constant 
    return pow(result, degree)

If we use the same x1 and x2 as used previously, we get the following:

x1= [4,8]
x2=[20,30] 
polynomial_kernel(x1,x2,2,0)
# result would be 102400

If we increase the degree of polynomial, we will try to get influenced by other vectors as the decision boundary becomes too complex and it will result in overfitting:

Polynomial kernel using degree as 6.

 

Gaussian kernel

The polynomial kernel has given us a good boundary line. But can we work with polynomial kernels all the time? Not in the following...

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 ₹800/month. Cancel anytime