Skip to content

Instantly share code, notes, and snippets.

@sithu
Created April 5, 2022 23:58
Show Gist options
  • Save sithu/f0be73456faefe222c863fe6fadb5406 to your computer and use it in GitHub Desktop.
Save sithu/f0be73456faefe222c863fe6fadb5406 to your computer and use it in GitHub Desktop.
# Loading the one_circle dataset
# ploy_svm.csv: https://gist.github.com/sithu/1a3c2dfbca74540fb2ee5a1aca1c4a0f
circular_data = pd.read_csv('poly_svm.csv')
features = np.array(circular_data[['x_1', 'x_2']])
labels = np.array(circular_data['y'])
utils.plot_points(features, labels)
# TODO: Degree = 2 vs Degree = 4
# Which one gives better accuracy?
svm_degree_2 = SVC(kernel='poly', degree=2)
svm_degree_2.fit(features, labels)
print("Polynomial kernel of degree = 2")
print("Accuracy:", svm_degree_2.score(features, labels))
utils.plot_model(features, labels, svm_degree_2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment