多项式回归值的生成距离坐标太远 [英] Polynomial Regression values generated too far from the coordinates

查看:84
本文介绍了多项式回归值的生成距离坐标太远的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照下面的多项式回归系数值代码,当我计算任意x点的回归值时.所获得的值与等效的y坐标相距甚远(特别是对于下面的坐标).任何人都可以解释为什么差异如此之大,可以将其最小化或理解上的任何缺陷.当前的要求是每点相差不超过150.

As per the the below code for Polynomial Regression coefficients value, when I calculate the regression value at any x point. Value obtained is way more away from the equivalent y coordinate (specially for the below coordinates). Can anyone explain why the difference is so high, can this be minimized or any flaw in understanding. The current requirement is not a difference of more 150 at every point.


import  numpy as np
x=[0,5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100]
y=[0,885,3517,5935,8137,11897,10125,13455,14797,15925,16837,17535,18017,18285,18328,18914,19432,19879,20249,20539,20746]                                                                                                     
z=np.polyfit(x,y,3)
print(z) 

我还尝试了Java中可用的各种代码,但是此数据的每个地方的系数值都相同.请帮助理解.
例如

I have also tried various various codes available in java, but the coefficient values are same every where for this data. Please help with the understanding.
For example


0.019168 * N^3 + -5.540901 * N^2 + 579.846493 * N + -1119.339450

N等于5值等于1643.76649
Y值885
N等于10值等于4144.20338
Y值3517
N等于100;值= 20624.29985
Y值20746

N equals 5 Value equals 1643.76649
Y value 885
N equals 10 Value equals 4144.20338
Y value 3517
N equals 100; Value=20624.29985
Y value 20746

推荐答案

查看完@Magnus的答案后,我降低了用于三阶多项式的数据限制.如您所见,在我粗略绘制的红色圆圈内的点不能与附近的数据同时位于一条平滑线上.尽管我可以通过数据拟合诸如希尔S型方程之类的平滑线,但数据方差(噪声)本身似乎是使该数据集达到150的绝对峰值误差的限制因素.

After I reviewed the answer of @Magnus, I reduced the limits used for the data in a 3rd order polynomial. As you can see, the points within my crudely drawn red circle cannot both lie on a smooth line with the nearby data. While I could fit smooth lines such as a Hill sigmoidal equation through the data, the data variance (noise) itself appears to be the limiting factor in achieving a peak absolute error of 150 with this data set.

这篇关于多项式回归值的生成距离坐标太远的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆