text_plain_output_2.png application_vnd.jupyter.stderr_output_1.png
from sklearn.linear_model import LogisticRegression

from sklearn.metrics import accuracy_score, confusion_matrix, f1_score, precision_score, recall_score

import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

path = '/kaggle/input/breast-cancer-wisconsin-data/data.csv'
df = pd.read_csv(path, index_col=0)

df.shape

df.columns

df.isnull().values.any()

df.isnull().sum()

df.drop('Unnamed: 32', axis=1, inplace=True)

df.isnull().values.any()

dup = df.loc[df.duplicated(), :]
len(dup)

corr = df.corr()
corr

sns.set(rc={'figure.figsize': (7, 7)})

fig, ax = plt.subplots(figsize=(7, 3))
sns.barplot(x="radius_mean", y="texture_mean", ax=ax, data=df[170:180])
plt.title("Radius Mean vs Texture Mean",fontsize=15)
plt.xlabel("Radius Mean")
plt.ylabel("Texture Mean")
plt.show()
plt.style.use("ggplot")

model = LogisticRegression()
model.fit(X_train, y_train)

X_train_prediction = model.predict(X_train)
training_data_accuracy = accuracy_score(y_train, X_train_prediction)
training_data_accuracy

X_test_prediction = model.predict(X_test)
test_data_accuracy = accuracy_score(y_test, X_test_prediction)
test_data_accuracy

fig, ax = plt.subplots(figsize=(4, 4))
sns.heatmap(confusion_matrix(y_test, X_test_prediction), annot=True, ax=ax)