algorithm - ask step by step levenberg-marquardt in java -
i'm trying write levenberg marquardt
in java, here's code:
while (iter <= 10 || mse < 0.0001) { call.calc_jacobian(ff, trainlm, input, akt1, akt2, w, x, t); double[][] jacobian = trainlm.ret_jacob(); double[][] error = trainlm.ret_err(); mse = trainlm.ret_mse() / 4; mse_all[iter] = mse; test: (int m = 0; m <= 5; m++) { upb.koreksi_w(miu, hidden, jacobian, error, w); double[][] w_new = upb.ret_upw(); call.test_ff(ff, trainlm, input, akt1, akt2, w_new, x, t); double mse2 = trainlm.ret_mse() / 4; if (mse2 < mse || m == 5) { miu = miu / beta; w_skrg = w_baru; iter++; break test; } else { miu = miu * beta; } } }
the function calc_jacobian
function use compute feed-forward , back-propagate operation calculate value of jacobian. function koreksi_w
use update new weight using jacobian, error, miu, , actual weight, give new weight , test_ff
calculate feedforward mse
value.
my problem when try run code, value of mse doesn't decrease, use trainlm
function in matlab
run same input & weight, prove input & wight isn't problem , in matlab
, mse
decrease.
i don't understand piece of code, sure integer division
want when :
mse = trainlm.ret_mse() / 4; //or: double mse2 = trainlm.ret_mse() / 4;
as expect double, suggest cast or :
double mse2 = trainlm.ret_mse() / (double)4; //or: double mse2 = trainlm.ret_mse() / 4.0;
check miu = miu / beta;
(is beta
double ?)
i suspect mathlab
floating point division java doesn't...
Comments
Post a Comment