Grey prediction model
Features of the gray system
(1) Use grey mathematics to deal with uncertain quantities and quantify them
(2) Make full use of known information to seek the law of movement of the system
(3) Grey system theory can handle poor information systems
There are five types of grey forecasting systems
(1) Sequence prediction
That is to use the observed time series reflecting the characteristics of the predicted object to construct a gray forecast model to predict the feature quantity at a certain moment in the future, or the time to reach a certain feature quantity
(2) Catastrophe and outlier prediction
That is, the gray model is used to predict the time when the outlier appears, and when the outlier appears in a specific time zone
(3) Seasonal catastrophe and outlier prediction
That is, the gray model is used to predict the catastrophe value that occurs in a specific time zone or season within a year.
(4) Topological prediction
The original data is drawn as a curve, all the time points when the fixed value occurs on the curve, and the fixed value is used to form the time point series, and then a model is built to predict the time point when the fixed value occurs.
(5) System forecast
Through the establishment of a set of interrelated gray prediction models for the system behavior characteristic indicators, the changes in the coordinated relationship among many variables in the system are predicted.
How to build a model-based grey forecast.
1: Data preprocessing
First, let's consider the problem from a simple example.
Accumulate data
2 Modeling principle
GM (1, 1) model
If you write a paper, go here
https://www.cnblogs.com/wuzaipei/p/11925321.html
GM(1,1) code
灰色预测步骤
(1)输入前期的小样本数据
(2)输入预测个数
(3)运行
y=input('请输入数据');
n=length(y);
yy=ones(n,1);
yy(1)=y(1);
for i=2:n
yy(i)=yy(i-1)+y(i)
end
B=ones(n-1,2);
for i=1:(n-1)
B(i,1)=-(yy(i)+yy(i+1))/2;
B(i,2)=1;
end
BT=B';
for j=1:(n-1)
YN(j)=y(j+1);
end
YN=YN';
A=inv(BT*B)*BT*YN;
a=A(1);
u=A(2);
t=u/a;
t_test=input('输入需要预测的个数');
i=1:t_test+n;
yys(i+1)=(y(1)-t).*exp(-a.*i)+t;
yys(1)=y(1);
for j=n+t_test:-1:2
ys(j)=yys(j)-yys(j-1);
end
x=1:n;
xs=2:n+t_test;
yn=ys(2:n+t_test);
plot(x,y,'^r',xs,yn,'*-b');
det=0;
for i=2:n
det=det+abs(yn(i)-y(i));
end
det=det/(n-1);
disp(['百分绝对误差为:',num2str(det),'%']);
disp(['预测值为:',num2str(ys(n+1:n+t_test))]);
+abs(yn(i)-y(i));
end
det=det/(n-1);
disp(['百分绝对误差为:',num2str(det),'%']);
disp(['预测值为:',num2str(ys(n+1:n+t_test))]);
https://blog.csdn.net/wuli_dear_wang/article/details/80587650