text_plain_output_1.png
from sklearn import model_selection

from sklearn.ensemble import BaggingClassifier

from sklearn.preprocessing import MinMaxScaler

from sklearn.tree import DecisionTreeClassifier

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

url = '../input/data.csv'
df = pd.read_csv(url, index_col=0)

df.replace('?', 0, inplace=True)
df.diagnosis = pd.get_dummies(df.diagnosis)
df = df.drop(labels='Unnamed: 32', axis=1)

scaler = MinMaxScaler(feature_range=(0, 1))
normalizedData = scaler.fit_transform(df.values)
names = list(df.columns)

normalizedData = pd.DataFrame(normalizedData)
normalizedData.columns = names
x = normalizedData.loc[:, normalizedData.columns != 'diagnosis']
y = normalizedData.diagnosis

kfold = model_selection.KFold(n_splits=10, random_state=17)
cart = DecisionTreeClassifier()
num_trees = 100
model = BaggingClassifier(base_estimator=cart, n_estimators=num_trees, random_state=17)
results = model_selection.cross_val_score(model, x, y, cv=kfold)
print(results.mean())