visionlab / memtoolbox Goto Github PK
View Code? Open in Web Editor NEWA MATAB toolbox for modeling visual working memory
Home Page: memtoolbox.org
License: BSD 2-Clause "Simplified" License
A MATAB toolbox for modeling visual working memory
Home Page: memtoolbox.org
License: BSD 2-Clause "Simplified" License
MemToolbox 1.0.0. The MemToolbox is a collection of MATLAB functions for modeling visual working memory. In support of its goal to provide a full suite of data analysis tools, the toolbox includes implementations of popular models of visual working memory, real and simulated data sets, Bayesian and maximum likelihood estimation procedures for fitting models to data, visualizations of data and fit, validation routines, model comparison metrics, and experiment scripts. The MemToolbox is released under a BSD license and is freely available. If you wish to acknowledge use of this software when you publish your research, you might say something like, "Data analysis was performed using the MemToolbox (Suchow, Brady, Fougnie, & Alvarez, 2013; memtoolbox.org)." and then cite: Suchow, J. W., Brady, T. F., Fougnie, D., & Alvarez, G. A. (2013). Modeling visual working memory with the MemToolbox. Journal of Vision, 13(10):9, 1โ8. doi:10.1167/13.10.9. The MemToolbox uses semantic versioning (http://semver.org/). Contents: MemFit.m - a general purpose fitting tool Setup.m - adds the toolbox and its subfolders to the path MemTutorial - a walkthrough of the toolbox MemModels - models of working memory from the literature MemData - real and simulated data sets MemFitting - tools to fit models to data MemModelComparison - tools to compare the ability of models to fit the data MemPlots - visualization tools MemExperiments - experiment scripts MemUtilities - internal helper functions MemTests - scripts that test toolbox functionality GeneralHelpers - helper functions that might be useful elsewhere paper.pdf - a high-level overview of the toolbox LICENSE - the terms under which this toolbox is licensed (BSD) README - chances are you've figured this out by now Contents - a list very much like this one Dependencies: 1. The Statistics Toolbox (http://www.mathworks.com/products/statistics/) is needed for all of the major functionality of the toolbox. 2. The Psychophysics Toolbox (http://psychtoolbox.org) is needed only for the experiment scripts in MemExperiments.
When attempting to run the MemToolbox demo experiment "ColorWorkingMemoryExperiment" I encounter the following error:
**Cannot find an exact (case-sensitive) match for 'RandSample'
Error in ColorWorkingMemoryExperiment (line 40)
itemToTest(trialIndex) = RandSample(1:nItems);**
Is there a "RandSample.m" file required to run this function that is different from the one provided by MathWorks ?
Many thanks,
Luc Boutsen
Aston University, Birmingham, UK
>> demo12
You've chosen to fit multiple subjects' data at once...
Subject number: 1
Error histogram: -180 _________.'._________ +180
Subject number: 2
Error histogram: -180 _________.'._________ +180
Model: standard mixture model
Parameters: g, sd
MTB will now fit the model to your datasets...
fit =
[1x1 struct] [1x1 struct]
You've chosen to fit multiple subjects' data at once...
... using a hierarchical model to fit the subjects together
Subject number: 1
Error histogram: -180 _________.'._________ +180
Subject number: 2
Error histogram: -180 _________.'._________ +180
Model: standard mixture model
Parameters: g, sd
MTB will now fit the model to your datasets...
??? Error using ==> mlecustom at 166
Error while evaluating the user-supplied logpdf function
'@(data,varargin)(model.logpdf(data,varargin{:})+model.logprior(cell2mat(varargin)))'.
Error in ==> mle at 225
phat = mlecustom(data,varargin{:});
Error in ==> MAP at 29
vals{c} = mle(data, 'logpdf', logPosterior, 'start', model.start(c,:), ...
Error in ==> MemFit>MemFit_MultipleSubjects at 368
params = MAP(dataCellArray, hModel);
Error in ==> MemFit at 138
fit = MemFit_MultipleSubjects(dataCellArray, model, verbosity,
hierarchy);
Error in ==> demo12 at 14
fit = MemFit(datasets, model, 'UseHierarchical', true)
Caused by:
Reference to non-existent field 'prior'.
We might consider try/catch-ing on the line that calls nansum() in sumWithNans(), to note the most likely source of the error is a missing Statistics Toolbox.
perhaps add it as an optional parameter to MemFit
"The issue of whether or not to include a Bayes factor computation using a sampling method is, frankly, a bit of a conundrum. I am not entirely comfortable with it, as my own experience with calculating Bayes' factors is mixed. Even a Laplace approximation, as suggested by the reviewer as an alternative, can be highly unstable for certain models. I would urge you not to include it as a pre-packaged model comparison tool, but I will not insist on it. You should, however, include a brief, critical discussion of the problems associated with computing Bayes' factors in the paper. "
for example,
AIC = ModelComparison_AIC_BIC(MemDataset(3), {SwapModel(), StandardMixtureModel()})
would report:
Error using mle>validateInputTypes (line 769)
Expected input to be one of these types:
single, double
Instead its type was struct.
Error in mle (line 258)
validateInputTypes(data, cens, freq, alpha, ntrials, theta, mu, truncation, start);
Error in MLE (line 42)
vals{c} = mle(data, 'logpdf', model.logpdf, 'start', model.start(c,:), ...
Error in ModelComparison_AIC_BIC (line 69)
[params, logLike(md)] = MLE(data, models{md});
>> MLE(MemDataset(10), SlotsPlusResourcesModel)
Warning: Maximum likelihood estimation did not converge. Function evaluation limit exceeded.
> In stats/private/mlecustom at 245
In mle at 225
In MLE at 37
ans =
2.9749 11.9768
Now that we have release a second version of the MemToolbox, we should update the documentation to recommend that citations include the version number used.
Hi, I am trying to use the memtoolbox to model my data, but I run into a problem everytime I use the function MemFit (even when I use the example data). Namely, I get this error:
`Just a moment while MTB fits a model to your data...
Running 3 chains...
Error using mvnrnd (line 35)
Index exceeds the number of array elements (0).
Error in MCMC>MCMC_Chain (line 234)
movement = mvnrnd(zeros(1, length(startInfo.cur)), curCov);
Error in MCMC (line 141)
parfor c=1:numChains
Error in MemFit>MemFit_SingleData (line 188)
posteriorSamples = MCMC(data, model, 'Verbosity', verbosity-1, ...
Error in MemFit (line 117)
fit = MemFit_SingleData(data, model, verbosity);`
I tried many different solutions, but could not find a way to solve this. I am using Matlab 2019a, could it be that some functions have changed since the first publication of the toolbox?
Many thanks! :)
The repmat
function in the lightspeed toolbox is incompatible with MemToolbox because it only handles matrices, not cell arrays, as is required by functions such as Hierarchical
, which use repmat
to create cell arrays of parameter names.
Hi,
In my experiment I have 3 conditions, is there a way to plot G and precision for all three of them in one plot?
Thank you!
Best
Ilaria
The Parallel Computing Toolbox fails with the latest Java update:
http://www.mathworks.com/support/bugreports/919688
It produces this error:
Error using matlabpool (line 134)
Java exception occurred:
java.lang.NullPointerException
at java.util.logging.Logger.demandLogger(Logger.java:286)
at java.util.logging.Logger.getLogger(Logger.java:321)
Error in aspenfun (line 3)
if(~(matlabpool('size') > 0)) matlabpool open;
It would be nice to catch the error and inform MemToolbox users so they don't despair.
One way to do it is by checking:
version -java
"Minor Point: Page 5. The authors claim that Jeffrey's priors "limit the range of parameter to those that are meaningful." Quite the opposite. Jeffrey's priors are location and/or scale invariance, that is, they do NOT limit the range of parameters. "
>> posteriorSamples = MCMC(data, model1)
Warning: matlabpool will be removed in a future release.
To query the size of an already started parallel pool, query the 'NumWorkers' property of the pool.
To check if a pool is already started use 'isempty(gcp('nocreate'))'.
Hi! I wanted to use the Hierarchical function to create a hierarchical model for my project, but got an error message:
Error using mle>validateInputTypes (line 769)
Expected input to be one of these types:single, double
Instead its type was struct.
After digging into it, it seems to me that in MAP(data, model) function, which is used in Hierarchical , the mle function from Statistics and Machine Learning Toolbox is used, with:
vals{c} = mle(data, 'logpdf', logPosterior, 'start', model.start(c,:), ...
'lowerbound', model.lowerbound, 'upperbound', model.upperbound, ...
'options', options);
But the mle is expecting "data" to be a vector variable, not a struct.
I'm not sure if it is a compatibility problem caused by the newer version of Statistics Toolbox (mine is version 12.2). Could you please see into this and update the MAP() function accordingly? It would be great if there's another way to run the MAP() function because I desperately need it for my group-level analysis - I tried fitting each subject individually but the results are not great.
Thank you!
Best,
Jiangang
"You should improve the discussion of the different model comparison metrics (see reviewer 2's comments). I agree with the reviewer that simply choosing the method least advantageous to one's preferred model is unprincipled. I don't expect a lengthy analysis of AIC, BIC, DIC and AICc, but a bit more than is currently provided is needed to guide users. The current discussion is a bit shallow as it distinguishes the different methods primarily based on their apparent biases rather than on the different computational principles from which they are derived."
"C. Minor Point: One of the earliest hierarchical models of psychological process is Rouder et al. (2003, Psychometrika). Rouder and Lu (2005, PBR) provide an early tutorial review of the benefits of hierarchical models of psychological process. The citations would be appropriate."
If you have set size 2, and try to run a swap model, it fails to converge.
demo10.m is currently:
data.errors = [-12 3 38 27 -29 21 -22 52 -2 -19 21 17 38 6 34 25 44];
MemFit(data, Orientation(WithBias(StandardMixtureModel)))
which is missing one of Orientation's required parameters, whichParameters, resulting in this error:
>> MemFit(data, Orientation(WithBias(StandardMixtureModel)))
??? Input argument "whichParameters" is undefined.
Error in ==> Orientation at 33
model.upperbound(whichParameters) = model.upperbound(whichParameters) ./ 2;
But when I do specify whichParameters, the MCMC chains never converge:
>> data.errors = [-12 3 38 27 -29 21 -22 52 -2 -19 21 17 38 6 34 25 44];
MemFit(data, Orientation(WithBias(StandardMixtureModel), 1))
Mean percent correct: 0.75
Model: Standard mixture model with bias (for orientation)
Parameters: mu, g, sd
Just a moment while MTB fits a model to your data...
Running 3 chains...
... not yet converged (200); btw/within variance: Inf
... not yet converged (400); btw/within variance: Inf
... not yet converged (600); btw/within variance: Inf
Hey guys,
Thanks for the toolbox. Great stuff. I noticed a little typo in the help of the VariablePrecisionModel function. When you talk about the optional argument 'HigherOrderDist', the examples pass this argument to the StandardMixtureModel and not the VariablePrecisionModel, which you probably mean.
Hope this helps, thanks again for the great toolbox!
Wouter
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.