Skip to content

Instantly share code, notes, and snippets.

@tarlanahad
Created March 21, 2020 16:28
Show Gist options
  • Save tarlanahad/553c4fed8dd6e0680e53845ef4b01d93 to your computer and use it in GitHub Desktop.
Save tarlanahad/553c4fed8dd6e0680e53845ef4b01d93 to your computer and use it in GitHub Desktop.
class SVM:
def __init__(self, X, y, num_of_epochs, lr, C):
self.X = X
self.y = y
self.num_of_epochs = num_of_epochs
self.lr = lr
self.C = C
# Add column vector of ones for computational convenience
self.X = np.column_stack((np.ones(len(X)), X))
# Initialize normal vector
self.w = np.ones(len(self.X[0]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment