function g = sigmoid(z)
%SIGMOID Compute sigmoid function
% g = 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).
denominator = 1.+exp(-z);
g = 1./denominator;
% =============================================================
end
吴恩达的机器学习编程作业3:sigmoid 计算s型函数
最新推荐文章于 2025-10-19 08:51:31 发布
本文介绍了一个用于计算Sigmoid函数的简单方法。Sigmoid函数在机器学习中被广泛应用于激活函数等场景,文章提供了如何对矩阵、向量或标量进行Sigmoid函数计算的具体实现。
1274

被折叠的 条评论
为什么被折叠?



