Skip to content

Commit 48ff901

Browse files
Ki Hyun KimKi Hyun Kim
Ki Hyun Kim
authored and
Ki Hyun Kim
committed
fix minor things
1 parent 0759d4b commit 48ff901

6 files changed

+47
-25
lines changed

lab-01_tensor_manipulation.ipynb

+16-5
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,9 @@
209209
{
210210
"cell_type": "code",
211211
"execution_count": 8,
212-
"metadata": {},
212+
"metadata": {
213+
"scrolled": true
214+
},
213215
"outputs": [
214216
{
215217
"name": "stdout",
@@ -257,7 +259,11 @@
257259
}
258260
],
259261
"source": [
260-
"t = torch.FloatTensor([[1., 2., 3.], [4., 5., 6.], [7., 8., 9.], [10., 11., 12.]])\n",
262+
"t = torch.FloatTensor([[1., 2., 3.],\n",
263+
" [4., 5., 6.],\n",
264+
" [7., 8., 9.],\n",
265+
" [10., 11., 12.]\n",
266+
" ])\n",
261267
"print(t)"
262268
]
263269
},
@@ -302,8 +308,13 @@
302308
"metadata": {},
303309
"outputs": [],
304310
"source": [
305-
"t = torch.FloatTensor([[[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]],\n",
306-
" [[13, 14, 15, 16], [17, 18, 19, 20], [21, 22, 23, 24]]]])"
311+
"t = torch.FloatTensor([[[[1, 2, 3, 4],\n",
312+
" [5, 6, 7, 8],\n",
313+
" [9, 10, 11, 12]],\n",
314+
" [[13, 14, 15, 16],\n",
315+
" [17, 18, 19, 20],\n",
316+
" [21, 22, 23, 24]]\n",
317+
" ]])"
307318
]
308319
},
309320
{
@@ -1340,7 +1351,7 @@
13401351
"name": "python",
13411352
"nbconvert_exporter": "python",
13421353
"pygments_lexer": "ipython3",
1343-
"version": "3.6.3"
1354+
"version": "3.6.5"
13441355
}
13451356
},
13461357
"nbformat": 4,

lab-03_minimizing_cost.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@
428428
"name": "python",
429429
"nbconvert_exporter": "python",
430430
"pygments_lexer": "ipython3",
431-
"version": "3.7.0"
431+
"version": "3.6.5"
432432
}
433433
},
434434
"nbformat": 4,

lab-05_logistic_classification.ipynb

+11-8
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
{
115115
"data": {
116116
"text/plain": [
117-
"<torch._C.Generator at 0x7f247d342fb0>"
117+
"<torch._C.Generator at 0x106951ed0>"
118118
]
119119
},
120120
"execution_count": 2,
@@ -265,7 +265,7 @@
265265
" [0.5000],\n",
266266
" [0.5000],\n",
267267
" [0.5000],\n",
268-
" [0.5000]], grad_fn=<MulBackward0>)\n",
268+
" [0.5000]], grad_fn=<MulBackward>)\n",
269269
"torch.Size([6, 1])\n"
270270
]
271271
}
@@ -413,7 +413,8 @@
413413
}
414414
],
415415
"source": [
416-
"-(y_train[0] * torch.log(hypothesis[0]) + (1 - y_train[0]) * torch.log(1 - hypothesis[0]))"
416+
"-(y_train[0] * torch.log(hypothesis[0]) + \n",
417+
" (1 - y_train[0]) * torch.log(1 - hypothesis[0]))"
417418
]
418419
},
419420
{
@@ -442,7 +443,8 @@
442443
}
443444
],
444445
"source": [
445-
"losses = -(y_train * torch.log(hypothesis) + (1 - y_train) * torch.log(1 - hypothesis))\n",
446+
"losses = -(y_train * torch.log(hypothesis) + \n",
447+
" (1 - y_train) * torch.log(1 - hypothesis))\n",
446448
"print(losses)"
447449
]
448450
},
@@ -559,7 +561,8 @@
559561
"\n",
560562
" # Cost 계산\n",
561563
" hypothesis = torch.sigmoid(x_train.matmul(W) + b) # or .mm or @\n",
562-
" cost = -(y_train * torch.log(hypothesis) + (1 - y_train) * torch.log(1 - hypothesis)).mean()\n",
564+
" cost = -(y_train * torch.log(hypothesis) + \n",
565+
" (1 - y_train) * torch.log(1 - hypothesis)).mean()\n",
563566
"\n",
564567
" # cost로 H(x) 개선\n",
565568
" optimizer.zero_grad()\n",
@@ -595,7 +598,7 @@
595598
"Epoch 300/1000 Cost: 0.057900\n",
596599
"Epoch 400/1000 Cost: 0.045300\n",
597600
"Epoch 500/1000 Cost: 0.037261\n",
598-
"Epoch 600/1000 Cost: 0.031673\n",
601+
"Epoch 600/1000 Cost: 0.031672\n",
599602
"Epoch 700/1000 Cost: 0.027556\n",
600603
"Epoch 800/1000 Cost: 0.024394\n",
601604
"Epoch 900/1000 Cost: 0.021888\n",
@@ -708,7 +711,7 @@
708711
"Epoch 40/100 Cost: 0.507066\n",
709712
"Epoch 50/100 Cost: 0.498539\n",
710713
"Epoch 60/100 Cost: 0.492549\n",
711-
"Epoch 70/100 Cost: 0.488208\n",
714+
"Epoch 70/100 Cost: 0.488209\n",
712715
"Epoch 80/100 Cost: 0.484985\n",
713716
"Epoch 90/100 Cost: 0.482543\n",
714717
"Epoch 100/100 Cost: 0.480661\n"
@@ -1043,7 +1046,7 @@
10431046
"name": "python",
10441047
"nbconvert_exporter": "python",
10451048
"pygments_lexer": "ipython3",
1046-
"version": "3.7.0"
1049+
"version": "3.6.5"
10471050
}
10481051
},
10491052
"nbformat": 4,

lab-06_1_softmax_classification.ipynb

+7-7
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
{
5151
"data": {
5252
"text/plain": [
53-
"<torch._C.Generator at 0x7f8740076fb0>"
53+
"<torch._C.Generator at 0x105eccfb0>"
5454
]
5555
},
5656
"execution_count": 2,
@@ -210,7 +210,7 @@
210210
}
211211
],
212212
"source": [
213-
"y = torch.randint(5, (3,))\n",
213+
"y = torch.randint(5, (3,)).long()\n",
214214
"print(y)"
215215
]
216216
},
@@ -560,7 +560,7 @@
560560
"cell_type": "markdown",
561561
"metadata": {},
562562
"source": [
563-
"이제 새로운 데이터로 코드를 돌려 피팅시켜보겠습니다."
563+
"Let's try another new dataset."
564564
]
565565
},
566566
{
@@ -573,16 +573,16 @@
573573
"output_type": "stream",
574574
"text": [
575575
"Epoch 0/1000 Cost: 1.849513\n",
576-
"Epoch 100/1000 Cost: 0.689895\n",
576+
"Epoch 100/1000 Cost: 0.689894\n",
577577
"Epoch 200/1000 Cost: 0.609259\n",
578578
"Epoch 300/1000 Cost: 0.551218\n",
579579
"Epoch 400/1000 Cost: 0.500141\n",
580580
"Epoch 500/1000 Cost: 0.451947\n",
581581
"Epoch 600/1000 Cost: 0.405051\n",
582582
"Epoch 700/1000 Cost: 0.358733\n",
583583
"Epoch 800/1000 Cost: 0.312912\n",
584-
"Epoch 900/1000 Cost: 0.269522\n",
585-
"Epoch 1000/1000 Cost: 0.241921\n"
584+
"Epoch 900/1000 Cost: 0.269521\n",
585+
"Epoch 1000/1000 Cost: 0.241922\n"
586586
]
587587
}
588588
],
@@ -628,7 +628,7 @@
628628
"name": "python",
629629
"nbconvert_exporter": "python",
630630
"pygments_lexer": "ipython3",
631-
"version": "3.7.0"
631+
"version": "3.6.5"
632632
}
633633
},
634634
"nbformat": 4,

lab-06_2_fancy_softmax_classification.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@
461461
"name": "python",
462462
"nbconvert_exporter": "python",
463463
"pygments_lexer": "ipython3",
464-
"version": "3.7.0"
464+
"version": "3.6.5"
465465
}
466466
},
467467
"nbformat": 4,

lab-07_1_tips.ipynb

+11-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,15 @@
6060
"metadata": {},
6161
"outputs": [],
6262
"source": [
63-
"x_train = torch.FloatTensor([[1, 2, 1], [1, 3, 2], [1, 3, 4], [1, 5, 5], [1, 7, 5], [1, 2, 5], [1, 6, 6], [1, 7, 7]])\n",
63+
"x_train = torch.FloatTensor([[1, 2, 1],\n",
64+
" [1, 3, 2],\n",
65+
" [1, 3, 4],\n",
66+
" [1, 5, 5],\n",
67+
" [1, 7, 5],\n",
68+
" [1, 2, 5],\n",
69+
" [1, 6, 6],\n",
70+
" [1, 7, 7]\n",
71+
" ])\n",
6472
"y_train = torch.LongTensor([2, 2, 2, 1, 1, 1, 0, 0])"
6573
]
6674
},
@@ -628,7 +636,7 @@
628636
"\n",
629637
"1. 더 많은 학습 데이터\n",
630638
"2. 더 적은 양의 feature\n",
631-
"3. **Regularization** (일반화)"
639+
"3. **Regularization**"
632640
]
633641
},
634642
{
@@ -742,7 +750,7 @@
742750
"name": "python",
743751
"nbconvert_exporter": "python",
744752
"pygments_lexer": "ipython3",
745-
"version": "3.7.0"
753+
"version": "3.6.5"
746754
}
747755
},
748756
"nbformat": 4,

0 commit comments

Comments
 (0)