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

📄 strsfun_out_new.m

📁 Neural Network in Finance (神经网络在金融界:赢得预言性的优势)全部原码。内容包括预测与估计
💻 M
字号:
function [error, yhat] = strsfun_out_new(beta);
global data1 squasher maxx minx maxy miny neuronxarg cthres; 
y = data1(:,1);
x = data1(:,2:end);
[nx, cx] = size(x);
% beta(1:2*cx+3) = abs(beta(1:2*cx+3));
if squasher == 1,
    yy = (y - miny)/(maxy-miny);
    for i = 1:cx, xx(:,i) = (x(:,i)-minx(i))/(maxx(i)-minx(i));
    end
else yy = y; xx = x;
end
if squasher == 1,
    cxarg = cthres-minx(neuronxarg) / (maxx(neuronxarg)-minx(neuronxarg));
else cxarg = cthres;
end
ny = length(yy);
xx1 = xx * beta(1:cx)' + ones(ny,1) * beta(2*cx+1);
xx2 = xx * beta(cx+1:2*cx)' + ones(ny,1) * beta(2*cx+2);
xx11 = xx1(2:end,:);
neuron1 = xx11;
xx22 = xx2(2:end,:);
neuron2 = 1 ./ (1+ exp(-xx22));
xx33 = xx(1:end-1,neuronxarg);
neuron3x = abs(beta(2*cx+3))* (xx33-cxarg);
neuron3 =  1 ./ (1 + exp(-neuron3x));
yhat1 = neuron3 .* neuron1 + (1- neuron3) .*   neuron2; 

nparm = 2 * cx + 15;
error = yy(2:end,:) - yhat1;
error = sum(error .^2);
sigma = error/ nparm;  
T = length(yhat1);          
loglik = 0;
error = -loglik;
if squasher == 1,
    yhat = yhat1 * (maxy-miny) + miny;
else yhat = yhat1;
end;
    




⌨️ 快捷键说明

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