Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

getting an error message when using hmcSampler

조회 수: 1 (최근 30일)
ektor
ektor 2019년 5월 28일
마감: MATLAB Answer Bot 2021년 8월 20일
Dear all,
I have this log-function on which I apply the hmcSampler:
T=1000;
g=randn(T,1);
u=randn(T,1);
k1=0.01;
k2=0.02;
for ii=1:T
logf=@(x)func(x,g, k1, k2,ii, u);
smp = hmcSampler(logf,u(ii))
end
where
function LL= func(x,y,k1,k2, t,u)
u(t)=x;
e2=(y-u).^2;
kk=- 0.5*x^2/k2;
M=-.5*sum(e2)/k1;
LL=M+kk;
end
Then, I get this error
Error using
stats.mcmc.utils.InputValidator.validateLogPDFAndStartAnalyticalGradient (line
346)
Error in calling log posterior density with the specified starting point.
Error in stats.mcmc.HamiltonianSampler.processLogPDFAndStartAnalyticalGradient
(line 577)
[~,~,isGradientRowVector] =
stats.mcmc.utils.InputValidator.validateLogPDFAndStartAnalyticalGradient(logpdf,start');
Error in stats.mcmc.HamiltonianSampler (line 284)
[logpdf,start] =
stats.mcmc.HamiltonianSampler.processLogPDFAndStartAnalyticalGradient(logpdf,start);
Error in hmcSampler (line 99)
hmc = stats.mcmc.HamiltonianSampler(logpdf,start,varargin{:});
Error in Main_code (line 53)
smp = hmcSampler(logf,u(ii))
Caused by:
Error using func
Too many output arguments.
I can not find what is causing this problem. "Too many output arguments."?
Any ideas,
Thanks a lot
  댓글 수: 1
ektor
ektor 2019년 5월 28일
편집: ektor 2019년 5월 31일
any ideas please?

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by