application_vnd.jupyter.stderr_output_1.png
from sklearn import ensemble

from sklearn.model_selection import train_test_split

from sklearn.model_selection import train_test_split

import matplotlib.pyplot as plt

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

import seaborn as sns

data = pd.read_csv('../input/data.csv')

import seaborn as sns
from pandas.plotting import scatter_matrix
import matplotlib.cm as cm
import matplotlib.pyplot as plt
data['diagnosis'] = data['diagnosis'].map({'M': 1, 'B': 0})
y = pd.DataFrame(data=data['diagnosis'])
list = ['Unnamed: 32', 'id', 'diagnosis']
x = data.drop(list, axis=1)

#correlation map
f,ax = plt.subplots(figsize=(18, 18))
sns.heatmap(x.corr(), annot=True, linewidths=.5, fmt= '.1f',ax=ax)

rem = ['perimeter_mean','radius_mean','compactness_mean','concave points_mean','radius_se','perimeter_se','radius_worst','perimeter_worst','compactness_worst','concave points_worst','compactness_se','concave points_se','texture_worst','area_worst']
data_new = x.drop(rem, axis=1)
f,ax = plt.subplots(figsize=(14, 14))
sns.heatmap(data_new.corr(), annot=True, linewidths=.5, fmt= '.1f',ax=ax)

data_new['diagnosis'] = y
corrmat = data_new.corr().abs()
top_corr_features = corrmat.index[abs(corrmat["diagnosis"])>0.1]
plt.figure(figsize=(10,10))
g = sns.heatmap(data_new[top_corr_features].corr(),annot=True,cmap="RdYlGn")

req = ['texture_mean', 'area_mean', 'smoothness_mean', 'concavity_mean', 'symmetry_mean', 'area_se', 'concavity_se', 'smoothness_worst', 'concavity_worst', 'symmetry_worst', 'fractal_dimension_worst']
data_new2 = data_new[req]
data_new = data_new.drop(['diagnosis'], axis=1)

data_final = pd.read_csv('../input/data.csv')
y_final = data_final['diagnosis'].map({'M': 0, 'B': 1})
data_final = data_final[req]

from sklearn.model_selection import train_test_split
x_final = data_final
x_train, x_test, y_train, y_test = train_test_split(x_final, y_final, test_size=0.2, random_state=42)
x_train.shape

from sklearn import ensemble
gbr = ensemble.GradientBoostingRegressor(n_estimators=400, max_depth=7, min_samples_split=8, learning_rate=0.1, loss='ls')
gbr = gbr.fit(x_train, y_train)
print(r2_score(y_test, gbr.predict(x_test)))
print(mean_squared_error(y_test, gbr.predict(x_test)))