Data preparation

After introducing the breast cancer dataset, we can analyze the code that will allow us to classify the input data line by line. In the first part of the code, we import the libraries we will use later:

from sklearn import linear_model, datasets, preprocessingfrom sklearn.cross_validation import train_test_splitfrom sklearn.pipeline import Pipelinefrom sklearn.neural_network import BernoulliRBMfrom pandas_ml import ConfusionMatriximport numpy as npimport pandas as pd

For now, let's limit ourselves to import; we will deepen them at the time of use. To start, we have to import the dataset; we will do so using the sklearn.datasets package:

BC = datasets.load_breast_cancer()

This command loads and returns the breast cancer

Get Hands-On Machine Learning on Google Cloud Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.