June 2016
Beginner to intermediate
304 pages
6h 24m
English
In the real world, we usually have to deal with a lot of raw data. This raw data is not readily ingestible by machine learning algorithms. To prepare the data for machine learning, we have to preprocess it before we feed it into various algorithms.
Let's see how to preprocess data in Python. To start off, open a file with a .py extension, for example, preprocessor.py, in your favorite text editor. Add the following lines to this file:
import numpy as np from sklearn import preprocessing
We just imported a couple of necessary packages. Let's create some sample data. Add the following line to this file:
data = np.array([[3, -1.5, 2, -5.4], [0, 4, -0.3, 2.1], [1, 3.3, -1.9, -4.3]])
We are now ...