Error using symengine Singularity.
Afficher commentaires plus anciens
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));
2 commentaires
Walter Roberson
le 5 Oct 2020
please attach the txt file
RUHIN CHOWDHURY
le 5 Oct 2020
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!