Git Product home page Git Product logo

Comments (10)

itsdfish avatar itsdfish commented on July 17, 2024 1

If you pull from master, you can try probability density plots. For example,

using SequentialSamplingModels
using Plots 

dist = DiffusionRace(;ν=[1,2,3], k=.30, A=.70, τ=.20)
plot(dist)

temp

You can overwrite the default settings by passing keyword arguments. The rt range uses Hick's law to identify the x max value. Its not perfect, but most of these models do not have a quantile function. In some cases, you will have to select your own range. Tomorrow I will look into a solution for the reflected plot. I'll also add a method using KDE for the simulation based models using traits. This seems like a good application for that technique.

from sequentialsamplingmodels.jl.

itsdfish avatar itsdfish commented on July 17, 2024

I like that idea. I think this is something that we can do in a separate package. Maybe SSMPlots.jl?

from sequentialsamplingmodels.jl.

DominiqueMakowski avatar DominiqueMakowski commented on July 17, 2024

Wouldn't it be overkill to have a dedicated package for, essentially, one function? Especially since I'm expecting the bulk of the code to be identical for most SSMs?
If your worry is the number of dependencies, wouldn't be addressed by optional soft dependencies, i.e., if the user has StatsPlots loaded then the function would work, if not, not? (that's just a wild guess as that's what we do in R or Python)

from sequentialsamplingmodels.jl.

itsdfish avatar itsdfish commented on July 17, 2024

Yeah. Bloat, increased dependencies, and increased load time is my concern. Julia recently introduced conditional loading which would allay may concerns for a small set of plots. I think if the number of plots becomes large, we can have a separate package.

What kind of plots and features do you think should be included? How should we display more than 3 distributions?

from sequentialsamplingmodels.jl.

itsdfish avatar itsdfish commented on July 17, 2024

Plot recipes might be useful too.

from sequentialsamplingmodels.jl.

DominiqueMakowski avatar DominiqueMakowski commented on July 17, 2024

I am really thinking of a very simple thing:

# Define generic internal plotting function
function _plot_ssm(distribution, xlim=(0, 3))
    # Takes distribution, generate density lines (black lines from the example above)
    # Plots choice 1 above choice 2 below
end

# Then define and export methods for each distribution
plot(distribution::LBA) = _plot_ssm
plot(distribution::DDM) = _plot_ssm
...

from sequentialsamplingmodels.jl.

itsdfish avatar itsdfish commented on July 17, 2024

Sounds good. I will take a look into some options later this week.

from sequentialsamplingmodels.jl.

DominiqueMakowski avatar DominiqueMakowski commented on July 17, 2024

Cool, very useful!

from sequentialsamplingmodels.jl.

itsdfish avatar itsdfish commented on July 17, 2024

I added methods for plot, plot!, histogram, and histogram! which work with all SSM models. Here is an example of each:

using SequentialSamplingModels
using Plots 

dist = RDM(;ν=[1,2,3], k=.30, A=.70, τ=.20)
h = histogram(dist)
plot!(h, dist)

histogram(dist)
plot!(dist)

plot(dist)
histogram!(dist)

p = plot(dist)
histogram!(p, dist)

dist = LCA()
p = plot(dist; t_range=range(.3, 1.2, length=100))
histogram!(p, dist)

plot(dist; t_range=range(.3, 1.2, length=100))
histogram!(dist)

h = histogram(dist)
plot!(h, dist; t_range=range(.3, 1.2, length=100))

histogram(dist)
plot!(dist; t_range=range(.3, 1.2, length=100))

dist = Wald(ν=3.0, α=.5, τ=.130)
h = histogram(dist)
plot!(h, dist; t_range=range(.130, 1.0, length=100))

histogram(dist)
plot!(dist; t_range=range(.130, 1.0, length=100))

p = plot(dist; t_range=range(.130, 1.0, length=100))
histogram!(p, dist)

plot(dist; t_range=range(.130, 1.0, length=100))
histogram!(dist)

I decided against adding the reflected plot for the following reasons: (1) it adds complexity to the code, (2) it only works in the case of 2 options, and (3) the marginal benefit of a reflected plot over a standard plot is small (perhaps is easier to compare the height of the densities because they are closer together). It just didn't seem worth the hassle of coding and maintaining.

The next step I need to do is figure out how to get the new plotting methods to become accessible to the docs. Its not showing up for some reason.

from sequentialsamplingmodels.jl.

itsdfish avatar itsdfish commented on July 17, 2024

@DominiqueMakowski, by the way, I am moving the plotting functionality to SSMPlots.jl because the conditional loading was too finicky in my experience. I thought it was working, but it turned out to only be working locally because I had KernelDensity in my global environment. Tried many different configurations for a few hours, but nothing reliably worked. If it worked, it stopped working after I removed the package and reinstalled it. Julia imposes a three day waiting period before a new package can be registered. In the meantime, if you want to use it, you can add it as add https://github.com/itsdfish/SSMPlots.jl.

from sequentialsamplingmodels.jl.

Related Issues (20)

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.