adding all work done so far (lessons 1 - 5)

This commit is contained in:
2019-07-10 19:58:53 +01:00
parent 8085149a49
commit b982957daf
37 changed files with 19407 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
# Import statements
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Read the data.
data = np.asarray(pd.read_csv('data.csv', header=None))
# Assign the features to the variable X, and the labels to the variable y.
X = data[:, 0:2]
y = data[:, 2]
# TODO: Create the model and assign it to the variable model.
# Find the right parameters for this model to achieve 100% accuracy
# on the dataset.
model = SVC(kernel='rbf', gamma=27)
# TODO: Fit the model.
model.fit(X, y)
# TODO: Make predictions. Store them in the variable y_pred.
y_pred = model.predict(X)
# TODO: Calculate the accuracy and assign it to the variable acc.
acc = accuracy_score(y, y_pred)