⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example_script_nn.m

📁 使用线性回归的方法对股市短期走势作出预测的程序
💻 M
字号:
% Example Script for NN

% This script will model a time series using the two different methods
% and then plot the forecasts versus real points

addpath('m_Files');

load Example_Data.mat;

x=Ibov;     % Load data from .mat file
d=1000;     % Defines where to start the forecasts
m=3;        % Size of histories (embeding dimension)
k=20;       % Number of nearest neighbors to use in the forecast's calculation

method_1='correlation';         
method_2='absolute_distance';

[OutSample_For_Corr,InSample_For_Corr,InSample_Res_Corr]=nn(x,d,m,k,method_1);

[OutSample_For_Abs,InSample_For_Abs,InSample_Res_Abs]=nn(x,d,m,k,method_2);

plot([x(d+1:end),InSample_For_Corr,InSample_For_Abs]);
xlabel('Time');
ylabel('Values');
title(['Forecasts VS Real values (m=',num2str(m),' , k=',num2str(k),' d=',num2str(d),')']);
legend('Ibov Real Series','NN forecast with correlation Method','NN forecast with abs distance Method');

rmpath('m_Files');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -