pxp1230 / yqyc

上海2022年3月疫情单日新增预测
https://pxp1230.github.io/yqyc/
8 stars 0 forks source link

The feature within your Polynomial Regression #1

Closed YiranJing closed 4 years ago

YiranJing commented 4 years ago

Hi @pxp1230,

Your model for 2019-nCoV looks good, want to learn from, but slightly confusing, so can you help me about these questions?

  1. what features you choose within Polynomial Regression.

Only see a text like this:

double result = p[0] + p[1] * x + p[2] * Math.Pow(x, 2) + p[3] * Math.Pow(x, 3) + p[4] * Math.Pow(x, 4) + p[5] * Math.Pow(x, 5);

Can you give me the interpretation of what p[i] are?

  1. -57.7620958751342+178.679492495802*x-44.9790201344528*x*x+2.59980450518181*x*x*x+0.147159013120125*x*x*x*x-0.00389681002953339*x*x*x*x*x

    I guess these numbers are the coefficients in the model? how you turn the coefficients?

非常感激感谢如果您能解答!!

pxp1230 commented 4 years ago

是的,你猜的都对,我用多项式来画近似曲线,p[i]就是多项式的系数,它可以很好的预测未来几天,希望能帮到你

YiranJing commented 4 years ago
for (int i = 0; i < raw.Count; i++)
            {
                xx[i] = raw[i].x;
                yy[i] = raw[i].y;
                //Console.WriteLine(item.x + " " + item.y);
            }

            double[] p = Fit.Polynomial(xx, yy, 5);

@pxp1230 您用xx 和degree 最高到5来fit yy,请问 这个xx (raw.x) 和yy (raw,y) 是什么呢?

HailiangJing commented 4 years ago

暗中观察,学习中

pxp1230 commented 4 years ago

xx是点的横坐标数组,yy是点的纵坐标数组

YiranJing commented 4 years ago

我看明白了!谢谢!!