how can i use simulated annealing for calculating the regression coefficients?

4 visualizzazioni (ultimi 30 giorni)
Hello
I want to use simulated annealing method to calculate the coefficients of the following regression model:
dx=a0+a1x+a2y
dy=b0+b1x+b2y
my cost function is RMSE of this model. how can i use the simulated annealing for this problem?
I ask my friends to guide me.
Thanks you

Risposte (1)

Torsten
Torsten il 12 Dic 2022
Modificato: Torsten il 12 Dic 2022
It's not simulated annealing, but most probably much faster.
M = [3979278.479 654200.79 35.38 -27.86
4196516.825 554782.87 24.62 -18.59
4232567.466 547982.05 19.88 -14.25
4075226.435 613109.41 33.11 -27.08
4118223.816 614123.66 23.23 -18.99
4133106.88 563347.67 32.14 -23.61
4178506.624 590038.35 15.94 -13.94
4065198.758 626890.47 34.94 -26.97
4155089.531 580988.82 24.37 -19.81
4132633.258 579808.77 28.04 -20.78
4080104.632 625582.59 32.2 -25.99
4073897.357 640928.48 26.13 -17.13
4055819.216 637942.92 34.4 -27.1
4119454.841 626505.32 13.02 -12.83
4203712.37 599359.61 10.45 -10.65
3936616.293 740450.19 30.15 -24.09
3969466.343 735778.54 26.27 -17.85
3978570.896 688822.82 32.94 -26.24
3989155.086 707440.89 32.72 -27.59
4001583.747 690843.64 33.48 -27.14
4006187.318 704299.83 11.6 -8.63
3946774.43 747480.17 26.67 -21.59
3967621.793 717309.19 32.47 -24.11
3983606.726 731375.87 17.78 -11.25
3978003.827 727514.86 28.17 -19.05
3936119.58 761801.36 24.16 -20.79
4301922.423 507200.19 16.87 -16.08
4316922.001 555890.75 8.48 -8.54
4101937.001 567780.19 35.27 -26.91
4038480.372 608158.43 36.34 -27.97];
y = M(:,1);
x = M(:,2);
dy = M(:,3);
dx = M(:,4);
A = [ones(size(y,1),1) x y];
b = dx;
solx = A\b;
a0 = solx(1)
a0 = -587.0689
a1 = solx(2)
a1 = 1.4526e-04
a2 = solx(3)
a2 = 1.1618e-04
norm(A*solx-dx);
figure(1)
plot(1:numel(dx),[dx,a0+a1*x+a2*y])
b = dy;
soly = A\b;
b0 = soly(1)
b0 = 814.4896
b1 = soly(2)
b1 = -1.9792e-04
b2 = soly(3)
b2 = -1.6232e-04
norm(A*soly-dy);
figure(2)
plot(1:numel(dy),[dy,b0+b1*x+b2*y])
  2 Commenti
Mary Tavoosi
Mary Tavoosi il 13 Dic 2022
thanks for your answer. ut i want to know, is possible and good to use SA for this problem? or i should use other way such as LS for this problem.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by