could anyone help me how to solve the issue in the following code

조회 수: 4 (최근 30일)
jaah navi
jaah navi 2020년 2월 21일
code:
input = [0 0 1;
0 1 1;
1 0 1;
1 1 1;
];
correct_Output = [0 0.5;
0 0.9;
1 1.2;
1 1.3;
];
Weight = 2*rand(1,3) - 1;
for epoch = 1:10000
Weight = SGD_method(Weight,input,correct_Output);
end
save('Trained_Network.mat')
%function
function Weight = SGD_method(Weight,input, correct_Output)
alpha = 0.9;
N = 4;
for k = 1:N
transposed_Input = input(k,:)';
d = correct_Output(k);
weighted_Sum = Weight*transposed_Input;
output = Sigmoid(weighted_Sum);
error = d-output;
delta = output*(1-output)*error;
dWeight = alpha*delta*transposed_Input;
Weight(1) = Weight(1) + dWeight(1);
Weight(2) = Weight(2) + dWeight(2);
Weight(3) = Weight(3) + dWeight(3);
end
end
%function
function y = Sigmoid(x)
y = 1/(1+exp(-x));
end
the above code excutes if
correct_Output = [0
0
1
1
]
but i want to execute the above code such that the
correct_Output = [0 0.5;
0 0.9;
1 1.2;
1 1.3;
];
Could anyone please help me on this.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by