依然是联系, 只不过是多变量的
但这次有点不一样, 因为你不得不normalization
结果是这个样子的
1.92077e+11 0.05
109139 -6719.28 340310
1.92102e+11 0.1
108828 -6864.04 340200
1.92144e+11 0.15
108512 -7010.52 340089
1.92206e+11 0.2
108192 -7159.55 339976
1.92286e+11 0.25
107869 -7310.78 339861
1.92386e+11 0.3
107541 -7464.25 339742
1.92507e+11 0.35
107210 -7619.77 339621
1.92649e+11 0.4
106876 -7777.23 339498
1.92812e+11 0.45
程序像这个样子
import std.stdio, std.math, std.conv, std.random, std.string;
class fit{
float a,b,c;
float alpha = 0.7;
float m;
float h(float x, float y){
return a*x+b*y+c;
}
void update(float x, float y, float z){
auto y1 = alpha*(h(x, y)-z)/m;
a -= y1*x;
b -= y1*y;
c -= y1;
}
this(float m){
a = uniform(-1.,1.);
b = uniform(-1.,1.);
c = uni