回覆列表
  • 1 # 使用者6704656755005

    梯度下降法曲線擬合 怎麼用matlab實現

    function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters)

    %GRADIENTDESCENT Performs gradient descent to learn theta

    % theta = GRADIENTDESENT(X, y, theta, alpha, num_iters) updates theta by

    % taking num_iters gradient steps with learning rate alpha

    % Initialize some useful values

    m = length(y); % number of training examples

    J_history = zeros(num_iters, 1);

    for iter = 1:num_iters,

  • 中秋節和大豐收的關聯?
  • 2003年屬羊大年初一什麼星座?