Undefined function 'sigmoid' for input arguments of type 'double'.

3 ビュー (過去 30 日間)
Priya
Priya 2014 年 10 月 22 日
回答済み: Guillaume 2014 年 10 月 22 日
addpath('C:\Program Files\MATLAB\R2012a\Matlab\q2')
load X.dat
load Y.dat
temp1=X(:,1);
temp2=X(:,2);
temp1=(temp1-mean(temp1))./std(temp1);
temp2=(temp2-mean(temp2))./std(temp2);
m=length(X);
X=[ones(m,1),temp1,temp2];
theta=[0;0;0];
MAX_ITR=100;
J=zeros(MAX_ITR,1);
alpha=0.07;
for num_iteration=1:MAX_ITR
J(num_iteration)=(1/m)*((-Y')*log(sigmoid(X*theta))-(1-Y')*log(1-sigmoid(X*theta)));
grad=(1/m)*X'*(sigmoid(X*theta)-Y);
theta=theta-alpha.*grad;
end
z=X*theta;
g=inline('(1./(1+exp(-z)))');
fprintf('Theta values are ...\n')
g(z)
Undefined function 'sigmoid' for input arguments of type 'double'.

回答 (1 件)

Guillaume
Guillaume 2014 年 10 月 22 日
As far as I can tell, sigmoid is not a function of matlab in any toolbox, so unless you've written it yourself and it's in the matlab path, it's not going to be found.

カテゴリ

Help Center および File ExchangeGet Started with Image Processing Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by