%% forward propagation

  for thetai = 1:num_theta

    z = activationLayers{thetai} * Thetas{thetai}';

    if num_theta > thetai

      activationLayers{thetai + 1} = [ones(m,1) sigmoid(z)];

    else

      activationLayers{thetai + 1} = sigmoid(z);

    end

    sum_Thetas = sum_Thetas + sum(sum(Thetas{thetai}(:,2:end) .^ 2));

    Zs{thetai + 1} = z;

  end


  %% backward propagation

  error_d = activationLayers{num_layers} - y_matrix;

  Deltas = {};


  for i = num_layers-1:-1:1 % Stop processing input layer

    Delta = error_d' * activationLayers{i};

    Deltas{i} = Delta;

    

    if i > 1 

      error_d = error_d * Thetas{i}(:, 2:end) .* sigmoidGradient(Zs{i});

    end

  end



식음을 전폐하고, 불금을 반납하고 4-5시간 매달린 끝에 결국 레귤라이제이션을 제외한 모든 문제 통과!


백 프로퍼게이션 제대로 구현하려면 포워드 프로퍼게이션이랑 둘이 궁짝이 잘 맞게 코딩해야 되는데 상당히 애를 먹음.



대충 보니까, 응센세 ML은 여기가 최대 고비고, 그 다음 부터는 한동안 자잘한 아기자기한 얘기로 풀어나가는 듯.


다음주부터는 약 2주 앞서서 6주차에 진입한닷!




한줄요약: ML을 죽어라 팠더니 눈아프고 개피곤함 ㅇㅇ