Comments (5)
On a user-experience note:
The fact that one needs to pass a data
object to the model formatted differently (as a tuple of individual tuples) than the data
object expected by the SSM distributions (as a tuple of vectors) makes it feel a bit clunky.
I wonder if it would not be easier to (additionally) allow for an independent specification of choice and rt in the distributions. For instance, add the rt=none
keyword arguments to LBA(data; **kwargs)
, and in case data
is a vector (i.e., someone just passed choice
alone) & rt != none
, we just re-format data = (choice=data, rt=rt)
as a first step in the function.
This would give some flexibility and hopefully make the practical usage smoother (also it would remove the need to do extra data transformation to make a vector of tuples).
An alternative version would be to also define
LBA(choice::Vector, rt::Vector; *kwargs)
LBA((choice=choice, rt=rt), ...)
This would probably be more elegant than having an optional keyword argument
from sequentialsamplingmodels.jl.
Wait no actually no this wouldn't work since we need something that can be indexed in the for i in n
loop of Turing... Okay nevermind then
EDIT: (and sorry for the spam, I wrote too quickly before giving a good thought) unless we allow data
to be a matrix with 2 columns (one for choice and for RT) (in which case it would also return a matrix) . We could then do X[i, :] ~ LBA(...)
from sequentialsamplingmodels.jl.
@DominiqueMakowski, no problem. These things can be a bit tricky. The convention I adopted with NamedTuples follows the same convention used throughout Distributions.jl. For example, rand(Normal())
returns a scalar while rand(Normal(), 1)
returns a vector. In this package, we return a NamedTuple of scalars for rand(LBA())
and a NamedTuple of vectors for rand(LBA(), 1)
.
You are right that the lack of indexing in the case of vectors is inconvenient. I did consider using a 2D array of floats instead, but the potential problem is that the choice indices are actually integers, and are often used for logical indexing (e.g. [rt[choice .==1])
. Unfortunately, logical indexing could potentially fail due to float point error. I'm not sure how likely it would be in the scope of these models, but it could potentially create a silent bug which could invalidate someone's analyses. Depending on what you are doing, destructuring the NamedTuple can convenient, e.g., choice,rt = rand(LBA(), n)
. As shown the doc strings, this works with broadcasting. Although the system is not perfect, I think some degree of pre-processing of data is almost unavoidable.
By the way, if you want a simpler way to generate a vector of NamedTuples, you can use a list comprehension or map:
n_obs =50
data1 = [rand(LBA(ν=[3.0, 2.0], A=0.8, k=0.2, τ=0.3)) for _ ∈ 1:n_obs]
data2 = [rand(LBA(ν=ν=[1.0, 1.5], A=0.8, k=0.2, τ=0.3)) for _ ∈ 1:n_obs]
data = vcat(data1, data2)
from sequentialsamplingmodels.jl.
I think we can close this
from sequentialsamplingmodels.jl.
I think there still might be a bug in Turing or Bijectors. We circumvented the problem by writing better code, but it seemed to be performing an unnecessary transformation. When I have time, I still raise the issue with devs at Turing.
from sequentialsamplingmodels.jl.
Related Issues (20)
- How to set up conditional parameters over the drift parameter in an LBA HOT 22
- patch release HOT 6
- Add plot() method HOT 10
- Estimating SSMs based on LANs HOT 2
- new release HOT 29
- Model Wishlist HOT 26
- Model assessment and indices of fit HOT 2
- LNR: vector of SDs HOT 1
- Testing ext across different machines HOT 1
- predict() broken? HOT 6
- LBA docs minor HOT 2
- Update version HOT 19
- Issue with pdf for WaldMixture HOT 5
- Increment Version HOT 15
- Simulating trial-level and hierarchical data HOT 10
- LNR model makes off-scale predictions for 1-choice data? HOT 7
- Minor docs: LBA args HOT 1
- Parametrizing RDM: "ERROR: DomainError with ..." log error HOT 2
- Standardize positional arguments for constructors.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sequentialsamplingmodels.jl.