Ich lerne über maschinelles Lernen aus Courrera. Ich versuche, die sigmoid Funktion zu berechnen, und ich habe den folgenden Code:Berechne die Sigmoid-Funktion
function g = sigmoid(z)
%SIGMOID Compute sigmoid functoon
% J = SIGMOID(z) computes the sigmoid of z.
% You need to return the following variables correctly
g = zeros(size(z));
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the sigmoid of each value of z (z can be a matrix,
% vector or scalar).
g = (1 + exp(-1 * z)) .^ -1;
g = 1/(1+ (1/exp(z)))
% my question is why the first g calculation works for matrix(say 100*2) however the second only works for (100*1) as both are trying to do the same this.
% =============================================================
end