Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Feature Engineering Made Easy

You're reading from   Feature Engineering Made Easy Identify unique features from your dataset in order to build powerful machine learning systems

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781787287600
Length 316 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Divya Susarla Divya Susarla
Author Profile Icon Divya Susarla
Divya Susarla
Sinan Ozdemir Sinan Ozdemir
Author Profile Icon Sinan Ozdemir
Sinan Ozdemir
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Introduction to Feature Engineering FREE CHAPTER 2. Feature Understanding – What's in My Dataset? 3. Feature Improvement - Cleaning Datasets 4. Feature Construction 5. Feature Selection 6. Feature Transformations 7. Feature Learning 8. Case Studies 9. Other Books You May Enjoy

A deeper look into the principal components


Before we take a look at our second feature transformation algorithm, it is important to take a look at how principal components are interpreted:

  1. Our iris dataset is a 150 x 4 matrix, and when we calculated our PCA components when n_components was set to 2, we obtained a components matrix of size 2 x 4:
# how to interpret and use components
 pca.components_ # a 2 x 4 matrix

 array([[ 0.52237162, -0.26335492, 0.58125401, 0.56561105], [ 0.37231836, 0.92555649, 0.02109478, 0.06541577]])
  1. Just like in our manual example of calculating eigenvectors, the components_ attribute can be used to project data using matrix multiplication. We do so by multiplying our original dataset with the transpose of the components_ matrix:
# Multiply original matrix (150 x 4) by components transposed (4 x 2) to get new columns (150 x 2)
 np.dot(X_scaled, pca.components_.T)[:5,]

 array([[-2.26454173, 0.5057039 ], [-2.0864255 , -0.65540473], [-2.36795045, -0.31847731], [-2...
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 $19.99/month. Cancel anytime
Banner background image