Skip to content

Commit dd866b3

Browse files
committed
Add comment for weight decay
1 parent 92bc059 commit dd866b3

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

ch06/overfit_dropout.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
x_train = x_train[:300]
1515
t_train = t_train[:300]
1616

17+
# Dropuoutの有無、割り合いの設定 ========================
1718
use_dropout = True # Dropoutなしのときの場合はFalseに
18-
dropout_ratio = 0.15
19+
dropout_ratio = 0.2
20+
# ====================================================
21+
1922
network = MultiLayerNetExtend(input_size=784, hidden_size_list=[100, 100, 100, 100, 100, 100],
2023
output_size=10, use_dropout=use_dropout, dropout_ration=dropout_ratio)
2124
trainer = Trainer(network, x_train, t_train, x_test, t_test,

ch06/overfit_weight_decay.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
x_train = x_train[:300]
1616
t_train = t_train[:300]
1717

18-
#weight_decay_lambda = 0
18+
# weight decay(荷重減衰)の設定 =======================
19+
#weight_decay_lambda = 0 # weight decayを使用しない場合
1920
weight_decay_lambda = 0.1
21+
# ====================================================
22+
2023
network = MultiLayerNet(input_size=784, hidden_size_list=[100, 100, 100, 100, 100, 100], output_size=10,
2124
weight_decay_lambda=weight_decay_lambda)
2225
optimizer = SGD(lr=0.01)

0 commit comments

Comments
 (0)