# coding: utf-8
get_ipython().magic(u'cd machine-learning-databases/')
get_ipython().magic(u'ls ')
get_ipython().magic(u'cd breast-cancer-wisconsin/')
get_ipython().magic(u'ls ')
import numpy as np
from sklearn import preprocessing, cross_validation
""" The sklearn.preprocessing package provides several common utiliy functions and transformer classes 
    ra features vectors into representations that is more suitable for downstream estimators """
""" Standardization of datasets is a common requirement for many machine learning estimators implemented in scikit 
    learn; they might behave badly if the individual features do not more or less look like standard normally distributed 
    data """
""" Standardization of datasets is a common requirement for many machine learning estimators implemented in scikit 
    learn - they might behave badly if the indivvidual ffeatures do not more orr less look like standard normall distriuted 
    data """
from sklearn import preprocessing
import numpy as np
X_train = np.array([[1., -1., 2.], 
                    [2., 0., 0.],
                    [0., 1., -1.]])
X_train
X_scaled = preprocessing.scale(X_train)
X_scaled
from sklearn import preprocessing, cross_validation, neighbours
from sklearn import preprocessing, cross_validation, neighbors
import pandas as pd
get_ipython().magic(u'ls ')
l
get_ipython().magic(u'ls ')
a = open('breast-cancer-wisconsin.names')
a
a.read()
df = pd.read_csv('breast-cancer-wisconsin.data')
df
df.head()
""" replacing missing data that is denoted by a question mark """
df.replace('?',-99999, inplace=True)
df
l
l
get_ipython().magic(u'ls ')
df = pd.read_csv('breast-cancer-wisconsin.data')
df.head()
get_ipython().magic(u'ls ')
get_ipython().magic(u'ls ')
get_ipython().magic(u'ls ')
l
get_ipython().magic(u'ls ')
df.drop(['id'], 1, inplace= True)
df
X = np.array(df.drop(['class']))
X = np.array(df.drop(df['class']))
df['class']
df
for i in df.columns:
    print i
    
df[' class']
X = np.array(df.drop(df[' class']))
X
y = np.array(df[' class'])
y
X
y
