<jupyter_start><jupyter_text>**Using all mean values features** Here we are constructing a ML Model that will predict malignant or benign tumors cells.After training our ML Model we need to test it's accuracy.<jupyter_code>X = df[['radius_mean', 'perimeter_mean', 'area_mean', 'concavity_mean', 'concave points_mean']]
y = df[['diagnosis']]

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 42)

accuracy_all = []
cvs_all = []<jupyter_output><empty_output><jupyter_text>**Nearest Neighbors**<jupyter_code>from sklearn.neighbors import KNeighborsClassifier
import warnings
warnings.filterwarnings("ignore")
knn = KNeighborsClassifier()
knn.fit(X_train, y_train)
knn_y_pred = knn.predict(X_test)
scores = cross_val_score(knn, X, y, cv=5)



accuracy_all.append(accuracy_score(knn_y_pred, y_test))
cvs_all.append(np.mean(scores))

print("Accuracy: {0:.2%}".format(accuracy_score(knn_y_pred, y_test)))
print("Cross validation score: {0:.2%} (+/- {1:.2%})".format(np.mean(scores), np.std(scores)*2))<jupyter_output>Accuracy: 92.11%
Cross validation score: 88.23% (+/- 7.06%)<jupyter_text>**Naive Bayes**<jupyter_code>from sklearn.naive_bayes import GaussianNB
gnb = GaussianNB()
gnb.fit(X_train, y_train)
gnb_y_pred = gnb.predict(X_test)
scores = cross_val_score(gnb, X, y, cv=5)



accuracy_all.append(accuracy_score(gnb_y_pred, y_test))
cvs_all.append(np.mean(scores))

print("Accuracy: {0:.2%}".format(accuracy_score(gnb_y_pred, y_test)))
print("Cross validation score: {0:.2%} (+/- {1:.2%})".format(np.mean(scores), np.std(scores)*2))<jupyter_output>Accuracy: 94.74%
Cross validation score: 90.87% (+/- 5.91%)<jupyter_text>**Logistic Regression**<jupyter_code>from sklearn.linear_model import LogisticRegression
logReg = LogisticRegression(random_state=0)
logReg.fit(X_train,y_train)
y_pred=logReg.predict(X_test)
accuracy_all.append(accuracy_score(y_pred, y_test))
cvs_all.append(np.mean(scores))

print("Accuracy: {0:.2%}".format(accuracy_score(y_pred, y_test)))
print("Cross validation score: {0:.2%} (+/- {1:.2%})".format(np.mean(scores), np.std(scores)*2))<jupyter_output>Accuracy: 92.98%
Cross validation score: 90.87% (+/- 5.91%)
{'fraction_non_alphanumeric': 0.16681985294117646, 'fraction_numerical': 0.02803308823529412, 'mean_word_length': 7.9958677685950414, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '238318', 'license': 'MIT', 'n_tokens_mistral': 939, 'n_tokens_neox': 862, 'n_words': 146, 'path': 'Machine Learning Approach/Notebook.ipynb', 'repo_name': 'ctrl-gaurav/Breast-Cancer-Cell-Type-Classification', 'size': '2176'}