📄 trainlog.m
字号:
function w = trainlog ( w , L , eta , alpha ) # train ( w , L , eta , alpha )# trains a single neuron from weight vector w# using global data in x,t# for a number of loops L# with learning rate eta; # there is weight decay alpha## the final weights are returned# also the weight history is logged to wl every dT its# using the global variable T global x ; global t ; global dT ; global T ; global wl ; for l = 1:L a = x * w ; y = sigmoid(a) ; e = t - y ; gw = x' * e ; w = w + eta * ( gw - alpha * w ) ;# keep log of w if T is a multiple of dT if ( round(T/dT) == (T/dT) ) wl(:,T/dT) = w ; endif T ++ ; endforendfunction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -