how to plot this function?
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
madhan ravi
2018년 11월 1일
P, t, lr, ErrorGoal, MaxIterations??
ariellewin11 ariellewin11
2018년 11월 1일
편집: ariellewin11 ariellewin11
2018년 11월 1일
Kevin Chng
2018년 11월 1일
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?
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!