Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2-level HGF implementation #260

Open
a-yur opened this issue Feb 13, 2024 · 3 comments
Open

2-level HGF implementation #260

a-yur opened this issue Feb 13, 2024 · 3 comments
Assignees
Labels
help wanted hgf Issues related to HGF Toolbox

Comments

@a-yur
Copy link

a-yur commented Feb 13, 2024

Is an implementation of a 2-level version of the binary HGF available in TAPAS? From what I understand, the existing implementation of the tapas_hgf_binary in TAPAS requires to have at least three levels.

We plan to model a stimulus sequence with a 2-level HGF and then use the trial-by-trial estimates as parametric modulators, similar to Stefanics et al. (2019, NeuroImage).

@chmathys
Copy link
Collaborator

chmathys commented Feb 13, 2024 via email

@chmathys chmathys self-assigned this Feb 13, 2024
@chmathys chmathys added help wanted hgf Issues related to HGF Toolbox labels Feb 13, 2024
@kwellstein
Copy link

Hi everyone,

we have a smilar issue.

We are trying to fit a 2-level eHGF binary (toolbox v7.1) but keep running into an "unstable region for the startpoint".
I tried multiple prior settings in the config file but cannot get anywhere. Maybe I am missing something fundamental though... Below the config file:

% Model name
c.model = 'ehgf_binary';

% Number of levels (minimum: 3)
c.n_levels = 2;

% Input intervals
% If input intervals are irregular, the last column of the input
% matrix u has to contain the interval between inputs k-1 and k
% in the k-th row, and this flag has to be set to true
c.irregular_intervals = false;

% Sufficient statistics of Gaussian parameter priors

% Initial mus and sigmas
% Format: row vectors of length n_levels
% For all but the first two levels, this is usually best
% kept fixed to 1 (determines origin on x_i-scale). The
% first level is NaN because it is determined by the second,
% and the second implies neutrality between outcomes when it
% is centered at 0.
c.mu_0mu = [NaN, 1]; % tried 0 too
c.mu_0sa = [NaN, 0];

c.logsa_0mu = [NaN, log(0.1)]; % tried log(1) too
c.logsa_0sa = [NaN, 0];

% Rhos
% Format: row vector of length n_levels.
% Undefined (therefore NaN) at the first level.
% Fix this to zero to turn off drift.
c.rhomu = [NaN, 0];
c.rhosa = [NaN, 0];

% Kappas
% Format: row vector of length n_levels-1.
% Fixing log(kappa1) to log(1) leads to the original HGF model.
% Higher log(kappas) should be fixed (preferably to log(1)) if the
% observation model does not use mu_i+1 (kappa then determines the
% scaling of x_i+1).
c.logkamu = [log(1)]; % also tried -Inf here
c.logkasa = [0];

% Omegas
% Format: row vector of length n_levels.
% Undefined (therefore NaN) at the first level.
c.ommu = [NaN, -3]; % also tried -6, -8, -10
c.omsa = [NaN, 4]; % also tried 4^2

thank you for your help :)

@kwellstein
Copy link

update:
We shouldnt have deleted the 3rd (or in some cases) 2nd column like the comments suggested. But still, the issue remains. This is the current config, I tried the same values as above.
The 3-level HGF fits without an issue. I also tried fitting the 2-level Hgf using random inputs, the error persists. The task has 280 trials.

c.mu_0mu = [NaN, 0, 1];
c.mu_0sa = [NaN, 0, 0];

c.logsa_0mu = [NaN, log(0.1), log(1)];
c.logsa_0sa = [NaN, 0, 0];

% Rhos
% Format: row vector of length n_levels.
% Undefined (therefore NaN) at the first level.
% Fix this to zero to turn off drift.
c.rhomu = [NaN, 0, 0];
c.rhosa = [NaN, 0, 0];

% Kappas
% Format: row vector of length n_levels-1.
% Fixing log(kappa1) to log(1) leads to the original HGF model.
% Higher log(kappas) should be fixed (preferably to log(1)) if the
% observation model does not use mu_i+1 (kappa then determines the
% scaling of x_i+1).
c.logkamu = [log(1), log(1)];
c.logkasa = [ 0, 0];

% Omegas
% Format: row vector of length n_levels.
% Undefined (therefore NaN) at the first level.
c.ommu = [NaN, -3, 2];
c.omsa = [NaN, 4, 0];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted hgf Issues related to HGF Toolbox
Projects
None yet
Development

No branches or pull requests

3 participants