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
CNN = SimpleCNN() | |
trainNet(CNN, batch_size=32, n_epochs=5, learning_rate=0.001) |
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
#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 |
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 Algorithmia | |
input = { | |
"username": "elonmusk", | |
"auth": { | |
"app_key": "xxxxxxxxxx", | |
"app_secret": "xxxxxxxxxx", | |
"oauth_token": "xxxxxxxxxx", | |
"oauth_token_secret": "xxxxxxxxxx" | |
} |
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
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(), |
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(...) |
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
const request = require('request'); | |
/** | |
* Sends input from a Slack SlashCommand to Algorithmia's nlp/SummarizeURL, and returns result | |
* | |
* @param {!Object} req Cloud Function request context. | |
* @param {!Object} res Cloud Function response context. | |
*/ | |
exports.summarizeURL = function summarizeURL(req, res) { | |
// verify that this request came from a valid Slack App |
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
sale_date | sale_price | |
---|---|---|
2017-09-07 | 2899.0 | |
2017-09-08 | 2645.0 | |
2017-09-09 | 2510.5 | |
2017-09-10 | 2412.5 | |
2017-09-11 | 2509.5 | |
2017-09-12 | 2391.4 | |
2017-09-13 | 2104.0 | |
2017-09-14 | 2002.2142857142858 | |
2017-09-15 | 1955.3125 |
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
sale_date | chicago | white | blue | |
---|---|---|---|---|
9/7/17 | 2899 | |||
9/8/17 | 2645 | |||
9/9/17 | 2510.5 | |||
9/10/17 | 2412.5 | |||
9/11/17 | 2509.5 | |||
9/12/17 | 2391.4 | |||
9/13/17 | 2104 | |||
9/14/17 | 2002.214286 | |||
9/15/17 | 1955.3125 |
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
sale_date | sale_price | |
---|---|---|
2017-08-20 | 1800.0 | |
2017-08-27 | 2100.0 | |
2017-09-03 | 2100.0 | |
2017-09-10 | 2547.6666666666665 | |
2017-09-17 | 2042.0597014925372 | |
2017-09-24 | 1870.6041666666667 | |
2017-10-01 | 1880.4285714285713 | |
2017-10-08 | 1885.357142857143 | |
2017-10-15 | 1869.68 |
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
sale_date | white | blue | chicago | |
---|---|---|---|---|
8/20/17 | 1800 | |||
8/27/17 | 2100 | |||
9/3/17 | 2100 | |||
9/10/17 | 2547.666667 | |||
9/17/17 | 2042.059701 | |||
9/24/17 | 1870.604167 | |||
10/1/17 | 1880.428571 | |||
10/8/17 | 1885.357143 | |||
10/15/17 | 1869.68 |
OlderNewer