Skip to content

Instantly share code, notes, and snippets.

View gagejustins's full-sized avatar

Justin Gage gagejustins

  • New York City
View GitHub Profile
#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(...)
@gagejustins
gagejustins / call.py
Last active July 9, 2020 20:43
Code for my tutorial on CNNs in Pytorch
CNN = SimpleCNN()
trainNet(CNN, batch_size=32, n_epochs=5, learning_rate=0.001)
date value
11/1/15 300
12/1/15 378.375
1/1/16 333.7916667
2/1/16 330.7696078
3/1/16 347.2945545
4/1/16 363.2814465
5/1/16 323.4774096
6/1/16 288.9470878
7/1/16 284.7981057
date value
9/1/85 1
1/1/89 3
2/1/90 1
1/1/91 1
1/1/92 1
2/1/92 1
4/1/92 1
5/1/92 1
11/1/92 1
name value
1 1.816577209
2 0.915437529
3 1.221136923
4 1.390603567
5 1.159949732
6 1.171404077
7 1.10246083
8 1.087708447
9 1.135507155
name value
A .08167
B .01492
C .02782
D .04253
E .12702
F .02288
G .02015
H .06094
I .06966
date accessories sneakers
10/1/17 1.896627168 1.838794332
11/1/17 1.94401401 1.739707228
12/1/17 1.921166761 1.824052705
1/1/18 1.99704023 2.06511041
2/1/18 2.04277584 2.003361492
3/1/18 1.845112974 1.62430097
4/1/18 1.737910393 1.55535178
5/1/18 1.677839147 1.626807553
6/1/18 1.552204215 1.429075154
sale_date sale_price
2018-12-03 4.5552375918112222
2018-12-10 3.9042580316765445
2018-12-17 3.7101137715418639
2018-12-24 3.7901464902186421
2018-12-31 3.7484495324438365
2019-01-07 3.7578998312236287
2019-01-14 3.8196466413502108
2019-01-21 3.7853349909584084
2019-01-28 3.7413680917124434
id category name value group
1 Bags supreme-small-shoulder-bag-black 4.49 high
2 Bags supreme-waist-bag-ss17-black 3.71 medium
3 Bags supreme-shoulder-bag-red 3.21 medium
4 Bags supreme-shoulder-bag-white 3.17 medium
5 Bags supreme-shoulder-bag-ss18-red 2.94 low
6 Bags supreme-shoulder-bag-ss18-tan 2.76 low
7 Bags supreme-shoulder-bag-ss18-black 2.61 low
8 Bags supreme-shoulder-bag-black 2.59 low
9 Bags supreme-shoulder-bag-dark-teal 2.52 low
sneaker_name sneaker_id count_wears brand wears_group
UltraBoost V4 White 1 3 Adidas medium
Boost 350 V2 White 2 1 Adidas low
Bball Low (Old) White 3 1 Common Projects low
Bball Low Nude 4 5 Common Projects high
Bball Low White 5 7 Common Projects high
Bball Low Gray 6 7 Common Projects high
Bball Low Taupe Suede 7 8 Common Projects high
React Element 87 Brown 9 1 Nike low
Blazer Low Pink 10 1 Nike low