Created
April 5, 2022 23:58
-
-
Save sithu/f0be73456faefe222c863fe6fadb5406 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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