how to plot this function?
Informazioni
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Mostra commenti meno recenti
if true
% code
endfunction [finalW, MSE, Numiterations] = gradientDescentLinearNeuron(P, t, lr, ErrorGoal, MaxIterations)
FinalW=(2*rand(1,100)-1)/10;
x=(2*rand(1,100)-1)/10;
x(:);
ErrorGoal=0.15;
lr=0.1;
step=1;
while ((MSE>ErrorGoal)&&(step<=MaxIterations))
y1=FinalW*x;
si=size(FinalW);
y2=ones(si);
y=[y1,y2];
dMSEdw=-1/((length(x)*((sum(t)-y)*x)));
FinalW=FinalW-lr*dMSEdw;
MSE=1/2*(length(x)*((sum(t)-y).^2));
step=step+1;
end
end
3 Commenti
madhan ravi
il 1 Nov 2018
P, t, lr, ErrorGoal, MaxIterations??
ariellewin11 ariellewin11
il 1 Nov 2018
Modificato: ariellewin11 ariellewin11
il 1 Nov 2018
Kevin Chng
il 1 Nov 2018
function [finalW, MSE, Numiterations] = gradientDescentLinearNeuron(P, t, lr, ErrorGoal, MaxIterations)
FinalW=(2*rand(1,100)-1)/10;
x=(2*rand(1,100)-1)/10;
x(:);
ErrorGoal=0.15;
lr=0.1;
step=1;
while ((MSE>ErrorGoal)&&(step<=MaxIterations))
y1=FinalW*x;
si=size(FinalW);
y2=ones(si);
y=[y1,y2];
dMSEdw=-1/((length(x)*((sum(t)-y)*x)));
FinalW=FinalW-lr*dMSEdw;
MSE=1/2*(length(x)*((sum(t)-y).^2));
step=step+1;
end
end
What do you want to plot?
plot(Numiterations,finalW)
What is the error?
Risposte (0)
Questa domanda è chiusa.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!