Last active
July 28, 2021 09:16
-
-
Save gagejustins/049281b521fdf845585b441e16b17b73 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
#Import the optim module from the pytorch package | |
import torch.optim as optim | |
#Initialize an optimizer object | |
learning_rate = 0.001 | |
optimizer = optim.Adam(net.parameters(), lr=learning_rate) | |
#Set the parameter gradients to 0 and take a step (as part of a training loop) | |
for epoch in num_epochs: | |
train(...) | |
optimizer.zero_grad() | |
optimizer.step() |
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
#Import the support vector machine module from the sklearn framework | |
from sklearn import svm | |
#Label x and y variables from our dataset | |
x = ourData.features | |
y = ourData.labels | |
#Initialize our algorithm | |
classifier = svm.SVC() | |
#Fit model to our data | |
classifier.fit(x,y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment