Team & @RobPratt Please look into the below code. First I am assigning values to w1-w8 and b1-b3. Then i am verifying that everything is populated in the correct fashion in the verification_dsn dataset. I am then using proc optmodel to validate if i reach similar/same numbers for w1-w8 and b1-b3. But everything comes out as 0. I had this example in excel and then using solver, i reached the numbers for w1-w8 and b1-b3. The formulas for minimize function and the constraint are exactly same. For example: If a+b=c then c-b=a. And I am just trying to validate that. But something is a miss here. Please advise. Thank You. @mkeintz: Tagging you because I thought you must be interested in the solution. data equation;
input y m x c;
datalines;
14 9 1 5
851 9 94 5
473 9 52 5
635 9 70 5
518 9 57 5
257 9 28 5
383 9 42 5
428 9 47 5
356 9 39 5
68 9 7 5
257 9 28 5
248 9 27 5
194 9 21 5
86 9 9 5
761 9 84 5
284 9 31 5
653 9 72 5
356 9 39 5
320 9 35 5
;run;
%let w1=0.094961;
%let w2=0.008734;
%let w3=6.21478;
%let w4=7.002409;
%let w5=0.012339;
%let w6=0.396723;
%let w7=13.94726;
%let w8=1.045836;
%let b1=0;
%let b2=0;
%let b3=0;
data verification_dsn;
set equation;
w1=0.094961;
w2=0.008734;
w3=6.21478;
w4=7.002409;
w5=0.012339;
w6=0.396723;
w7=13.94726;
w8=1.045836;
b1=0;
b2=0;
b3=0;
n1h1=x*&w1.-&b1.;
n2h1=x*&w2.-&b1.;
n1h2=((x*&w1.-&b1.)*&w3.)+((x*&w2.-&b1.)*&w4.)-&b2.;
n2h2=(n1h1*&w5.)+(n2h1*&w6.)-&b2.;
output_network=(n1h2*&w7.)+(n2h2*&w8.)-&b3.;
sq_diff=(y-output_network)**2;
minimize_function=(y-(((((x*w1-b1)*w3)+((x*w2-b1)*w4)-b2)*w7)+((((x*w1-b1)*w5)+((x*w2-b1)*w6)-b2)*w8)-b3))**2;
constraint=abs(((((x*w1-b1)*w3)+((x*w2-b1)*w4)-b2)*w7)+((((x*w1-b1)*w5)+((x*w2-b1)*w6)-b2)*w8)-b3);
run;
proc optmodel;
var w1 ,w2 ,w3 ,w4 ,w5 ,w6 ,w7 ,w8 ,b1 ,b2 ,b3;
number x ,y;
read data equation into x y;
min sq_diff=(y-(((((x*w1-b1)*w3)+((x*w2-b1)*w4)-b2)*w7)+((((x*w1-b1)*w5)+((x*w2-b1)*w6)-b2)*w8)-b3))**2;
con y = abs(((((x*w1-b1)*w3)+((x*w2-b1)*w4)-b2)*w7)+((((x*w1-b1)*w5)+((x*w2-b1)*w6)-b2)*w8)-b3);
solve;
print w1 w2 w3 w4 w5 w6 w7 w8 b1 b2 b3;
expand / iis;
quit;
... View more