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
Python Data Science Essentials

You're reading from   Python Data Science Essentials Become an efficient data science practitioner by thoroughly understanding the key concepts of Python

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781785280429
Length 258 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Feature creation

Sometimes, you'll find yourself in a situation where features and target variables are not really related. In this case, you can modify the input dataset, apply linear or nonlinear transformations that can improve the accuracy of the system, and so on. It's a very important step of the process because it completely depends on the skills of the data scientist, who is the one responsible for artificially changing the dataset and shaping the input data for a better fit with the classification model.

For example, if you're trying to predict the value of a house and you just know the height, width, and the length of each room, you can artificially build a feature that represents the volume of the house. This is strictly not an observed feature, but it's a feature built on the top of the existing ones. Let's start with some code:

In: import numpy as np
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.metrics...
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