<jupyter_start><jupyter_text>**poly kernel**<jupyter_code>clf = svm.SVC(kernel='poly', C=0.1, degree=3)
clf.fit(training_samples, training_labels)
pred_labels = clf.predict(testing_samples)
print(testing_labels, pred_labels)
print('ACC score: {}'.format(accuracy_score(testing_labels, pred_labels)))<jupyter_output>[ 1.  1. -1.] [ 1.  1. -1.]
ACC score: 1.0<jupyter_text>**linear kernel**<jupyter_code>clf = svm.SVC(kernel='linear', C=0.1)
clf.fit(training_samples, training_labels)
pred_labels = clf.predict(testing_samples)
print(testing_labels, pred_labels)
print('ACC score: {}'.format(accuracy_score(testing_labels, pred_labels)))<jupyter_output>[ 1.  1. -1.] [ 1.  1. -1.]
ACC score: 1.0<jupyter_text>**rbf kernel**<jupyter_code>clf = svm.SVC(kernel='rbf')
clf.fit(training_samples, training_labels)
pred_labels = clf.predict(testing_samples)
print(testing_labels, pred_labels)
print('ACC score: {}'.format(accuracy_score(testing_labels, pred_labels)))<jupyter_output>[ 1.  1. -1.] [ 1.  1. -1.]
ACC score: 1.0<jupyter_text>**sigmoid kernel**<jupyter_code>clf = svm.SVC(kernel='sigmoid')
clf.fit(training_samples, training_labels)
pred_labels = clf.predict(testing_samples)
print(testing_labels, pred_labels)
print('ACC score: {}'.format(accuracy_score(testing_labels, pred_labels)))<jupyter_output>[ 1.  1. -1.] [-1. -1. -1.]
ACC score: 0.3333333333333333
{'fraction_non_alphanumeric': 0.17033773861967694, 'fraction_numerical': 0.0381791483113069, 'mean_word_length': 7.41358024691358, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '578738', 'license': 'Apache-2.0', 'n_tokens_mistral': 568, 'n_tokens_neox': 540, 'n_words': 88, 'path': 'hw1/SVM.ipynb', 'repo_name': 'ThreeSRR/SJTU-AU331-MLKD', 'size': '1362'}