资源简介
替代数据法的matlab程序,希望对大家有帮助
代码片段和文件信息
function rhomax=findrho(ydetautargetAopt);
%function rho=findrho(ydetauptargetAopt);
%
%find the optimal value of rho for the pls surrogate generation algorithm.
%Uses the premise that the optimal value is that which produces surrogates
%that have the greatest number of short sequences identical to the data.
%Now the number of short identical sequences is related to the transition
%probability (i.e. the probability that we don‘t just follow the current
%state) if the transition probability p is 0.5 the the probability of a
%sequence of length 2 (the shortest allowable) p(1-p) is maximal. Lower the
%probability for longer sequences.
%
%if de is a vector then it is a vector of lags (min 0).
%
%computation is pseudo-analytic (certainly not stochastic)
%
%Aopt is optional
%
%Michael Small
%3/3/2005
%ensmall@polyu.edu.hk
%parameters
if nargin<5
Aopt=[];
end;
if nargin<4
target=0.5;
end;
if nargin<3
tau=[];
end;
if nargin<2
de=[];
end;
if isempty(de)
de=3;
end;
if isempty(tau)
tau=1;
end;
y=y(:);
ny=length(y);
if length(de)>1
x=embed(yde);
else
x=embed(ydetau);
end;
[den]=size(x);
if isempty(Aopt)
Aopt=ones(1de);
end;
%memory limitation
maxsize=3000;
if n>maxsize
x=x(:end+(1-maxsize:0));
n=maxsize;
disp(‘WARNING: too much data to handle in findrho3 ... truncating‘);
end;
%compute the switch probabilities for each point
%first the L2-norm^2
dd=zeros(nn);
for i=1:de %loop on de and compute the distance.^2
dd=dd+Aopt(i)*(ones(n1)*x(i:)-x(i:)‘*ones(1n)).^2;
end;
dd=sqrt(dd);
tol=0.0000001;
rhou=std(y);
rhol=rhou/2;
pl=1;pm=1;
pp=exp(-0.5.*dd/rhou);
pu=sum(pp);
pu=(pu-diag(pp)‘)./pu;
pu=mean(pu);
pp=exp(-0.5.*dd/rhol);
pl=sum(pp);
pl=(pl-diag(pp)‘)./pl;
pl=mean(pl);
while (rhou-rhol)>tol
if pl>target %both bounds too big
pu=pl;
rhou=rhol;
rhol=rhol/2;
%recompute pl
pp=exp(-0.5.*dd/rhol);
pl=sum(pp);
pl=(pl-diag(pp)‘)./pl;
pl=mean(pl);
rhom=mean([rholrhou]);
elseif pu pl=pu;
rhol=rhou;
rhou=rhou*2;
%recompute pu
pp=exp(-0.5.*dd/rhou);
pu=sum(pp);
pu=(pu-diag(pp)‘)./pu;
pu=mean(pu);
rhom=mean([rholrhou]);
else %dead on so tighten them
rhom=mean([rholrhou]);
%compute pm
pp=exp(-0.5.*dd/rhom);
pm=sum(pp);
pm=(pm-diag(pp)‘)./pm;
pm=mean(pm);
if pm rhol=rhom;
pl=pm;
else
rhou=rhom;
pu=pm;
end;
end;
disp([num2str(rhol)‘<‘num2str(rhom)‘<‘num2str(rhou)]);
end;
disp([‘Final prob=‘num2str(pm)]);
rhomax=rhom;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 82 2006-03-17 11:05 替代数据法的matlab程序\__MACOSX\surrogates\._.DS_Store
文件 82 2006-03-17 10:54 替代数据法的matlab程序\__MACOSX\surrogates\._pps.c
文件 6148 2006-03-17 11:05 替代数据法的matlab程序\surrogates\.DS_Store
文件 2818 2006-03-29 11:25 替代数据法的matlab程序\surrogates\findrho.m
文件 2970 2005-03-06 22:46 替代数据法的matlab程序\surrogates\findrhoquick.m
文件 893 2005-03-06 22:46 替代数据法的matlab程序\surrogates\get_bins.m
文件 8432 2006-03-17 10:54 替代数据法的matlab程序\surrogates\pps.c
文件 566 2005-03-06 22:47 替代数据法的matlab程序\surrogates\pps.m
文件 244 2005-03-06 22:47 替代数据法的matlab程序\surrogates\shuffle.m
文件 2352 2005-03-06 22:47 替代数据法的matlab程序\surrogates\shufflecycle.m
文件 1968 2005-03-06 22:48 替代数据法的matlab程序\surrogates\surrogate.m
文件 3080 2005-03-06 22:49 替代数据法的matlab程序\surrogates\surrogates.m
目录 0 2006-03-29 11:26 替代数据法的matlab程序\__MACOSX\surrogates
目录 0 2006-03-29 11:26 替代数据法的matlab程序\__MACOSX
目录 0 2006-03-29 11:26 替代数据法的matlab程序\surrogates
目录 0 2009-10-18 12:48 替代数据法的matlab程序
----------- --------- ---------- ----- ----
29635 16
评论
共有 条评论