Giter VIP home page Giter VIP logo

cbm's People

Contributors

payampiray avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cbm's Issues

discrepancy between manual and example datasets

We have been using the utility but there are some minor issues in the examples and the data provided
First the manual says
"Suppose you have 40 subjects' choice data in a 2-armed bandit task, in which subjects chose between two actions and received binary outcomes.
All data have been stored in a mat-file called all_data.mat in a cell format, in which each cell contains choice data and outcomes for one subject."

The data file all_data.mat has only 20 Ss in it.

Second, when I run the example as per the example
% data of subject 1
subj1 = data{1};
parameters = randn(1,2);
F1 = model_RL(parameters,subj1)

it fails because the data for subject1, extracted from all_data.mat do not have a field called actions in the subj1 structure. (There are fields like subj1.choice1 and subj1.choice2 plus numerous other fields.)

So I added a field to subj1 thus
subj1.actions=subj1.choice1

but then the commands from the manual here
parameters = randn(1,2);
F1 = model_RL(parameters,subj1)

fail with this error message
Array indices must be positive integers or logical values.
Error in model_RL (line 41)
delta = o - q(a); % prediction error

So I wonder if the subj structure needs to contain ONLY the actions and outcome fields
so I make a new subject structure like that, but it crashes with the same error message when I run
F1 = model_RL(parameters,subj1)

model_hybrid state 2 initalization

I'm relatively new to modeling in the two-step task and I wanted to thank you for your amazing resource!

I was going through your code on model_hybrid.m and think there may be an error in how the second state is defined on line 31. Specifically, the dataset you provide codes choice2 as either 1 (left) or 2 (right), but the code on line 31 seems to want choice2 values that are 3 or 4. Additionally, the data you provide already includes the second state information so I'm not sure why it would be needed to infer it from the choice2 values.

Sorry if I'm missing something obvious and I've made an error, but in the off chance I didn't I wanted to raise this with you.

Error when no minimum found using Laplace fitting

Thanks for this toolkit, it's straight-forward to use and add your own likelihood functions.

I ran into this error when fitting the included "model_dualRL":

Subject: 27
--- No positive hessian found in spite of 100 initialization.

bad subject 27 ... use liberal tolgrad 0.1000
--- No positive hessian found in spite of 100 initialization.
No minimum found for subject 27
No minimum found, use prior values as individual parameters
Error using double
Conversion to double from cell is not possible.

Error in  ^  (line 44)
        X = double(X);

Error in cbm_lap (line 169)
    Ainvdiag{n}  = diag(A_n^-1);

I think this is due to an error in the cbm_lap.m file (lines 152-162) when using the prior as fitted value when the function can't find a good fit at all. I could fix it and progress by changing the below:

if pconfig.prior_for_bads
    if verbose, fprintf(fid,'No minimum found, use prior values as individual parameters\n'); end
    theta_n   = mu;
    [loglik_n]  = cbm_loggaussian(theta_n',model,prior,dat);
    % A_n       = A;  % old
    A_n       = A{n};  % new
    G_n       = nan(1,d);
else
    cbm     = sprintf(fid,'No minimum found for subject %02d\n',n);
    success = 0;
    return;
end

CBM has worked well until now, but perhaps I've not encountered cases before when the fit is so bad it has to use the prior? It could also be I've just done something wrong on my end :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.