Error using symengine Singularity.
Show older comments
My code is showing Singularity problem. When int_theta is set to zero, there is no problem. But when it is set to values other than zero, I am getting the error for 'jc' stated below. The 'g0' gives me result perfectly but 'jc' shows error. Please can anyone show me where has it gone worng?
ERROR:
Error using symengine
Singularity.
Error in sym/double (line 692)
Xstr = mupadmex('symobj::double', S.s, 0);
Error in Logistic (line 51)
jc= double(subs(J,theta,int_theta));
syms a b c
data = load('exdata.txt'); % Load Data from a source
X = data(:, [1, 2]);
y = data(:, 3);
[m, n] = size(X); % find X
X = [ones(m, 1) X]; % Add x0 as 1
int_theta = [-2;1;2]; % set initial theta values
theta = [a;b;c] ; % set theta as variable
g= 1./(1+ exp(-X*theta)); % set sigmoid function as eqn
g0= double(subs(g,theta,int_theta)); % find value of Sig funct for int_theta
J= (-1/m).* sum(y.*log(g)+ (1-y).*log(1-g)); % cost funct
jc= double(subs(J,theta,int_theta)); % find value of cost funct for int_theta
j= gradient(J, theta); % find dJ/d(theta)
double(subs(j,theta,int_theta));
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!