<jupyter_start><jupyter_text>download the breast cancer dataset from here: https://www.kaggle.com/rcfreitas/python-ml-breast-cancer-diagnostic-data-set/data<jupyter_code>data = pd.read_csv('data.csv')
data.head()
data.columns
data = data.drop(['id', 'Unnamed: 32'], axis =1 )
data.head()
diag_map = {'M':1, 'B':0}
data['diagnosis'] = data['diagnosis'].map(diag_map)<jupyter_output><empty_output><jupyter_text>A Support Vector Machine (SVM) is a binary linear classification whose decision boundary is explicitly constructed to minimize generalization error. It is a very powerful and versatile Machine Learning model, capable of performing linear or nonlinear classification, regression and even outlier detection.SVM is well suited for classification of complex but small or medium sized datasets.If observations are “linearly separable”, SVM fits the “decision boundary” that is defined by the largest margin between the closest points for each class. This is commonly called the “maximum margin hyperplane (MMH)”.<jupyter_code>X = data.loc[:,data.columns != 'diagnosis']
y = data.loc[:, 'diagnosis']

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

accuracy_all = []
clf = LinearSVC()
clf.fit(X_train, y_train)
prediction = clf.predict(X_test)
scores = cross_val_score(clf, X, y, cv=5)

accuracy_all.append(accuracy_score(prediction, y_test))

print("LinearSVC Accuracy: {0:.2%}".format(accuracy_score(prediction, y_test)))
pd.crosstab(y_test, prediction, rownames=['Actual Result'], colnames=['Predicted Result'])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11982434127979925, 'fraction_numerical': 0.0075282308657465494, 'mean_word_length': 6.857142857142857, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '272937', 'license': 'MIT', 'n_tokens_mistral': 528, 'n_tokens_neox': 503, 'n_words': 148, 'path': 'Section 4/4.1.ipynb', 'repo_name': 'serdarbozoglan/Scikit-learn-Recipes', 'size': '1594'}