Skip to content

Instantly share code, notes, and snippets.

Justin Gage gagejustins

Block or report user

Report or block gagejustins

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View checkpoint.py
for epoch in range(numEpochs):
train(...) #Training code
accuracy = eval(...) #Evaluate accuracy
#If we've reached a new best accuracy
if accuracy > best_accuracy:
#Save model checkpoint
torch.save({'epoch': epoch,
'state_dict': model.state_dict(),
@gagejustins
gagejustins / followers.py
Last active Apr 5, 2018
Code for Twitter algorithm spotlight
View followers.py
import Algorithmia
input = {
"username": "elonmusk",
"auth": {
"app_key": "xxxxxxxxxx",
"app_secret": "xxxxxxxxxx",
"oauth_token": "xxxxxxxxxx",
"oauth_token_secret": "xxxxxxxxxx"
}
@gagejustins
gagejustins / call.py
Last active Mar 23, 2018
Code for sentiment analysis with Twitter demo
View call.py
#Define your API Key from Algorithmia
apikey = 'YOUR_API_KEY'
#Initialize the Algorithmia client
client = Algorithmia.client(apikey)
#Create an instance of the RetrieveTweetsWithKeyword algorithm
algo = client.algo('diego/RetrieveTweetsWithKeyword/0.1.2')
#Call the algorithm for both of our keywords and store the results
@gagejustins
gagejustins / call.py
Last active Mar 6, 2019
Code for my tutorial on CNNs in Pytorch
View call.py
CNN = SimpleCNN()
trainNet(CNN, batch_size=32, n_epochs=5, learning_rate=0.001)
You can’t perform that action at this time.