小编use*_*936的帖子

计算S形函数

我正在从Coursera学习机器学习。我正在尝试计算sigmoid函数,我有以下代码:

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 …
Run Code Online (Sandbox Code Playgroud)

matlab machine-learning sigmoid

-1
推荐指数
2
解决办法
1万
查看次数

标签 统计

machine-learning ×1

matlab ×1

sigmoid ×1