Giter Club home page Giter Club logo

kissabc.jl's People

Contributors

francescoalemanno avatar github-actions[bot] avatar stevensiew 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

Watchers

 avatar  avatar

kissabc.jl's Issues

register 1.3

@JuliaRegistrator register

  • added kernel ABC differential evolution,
    it requires much less generations to reach reasonable posterio distributions compared to non kernel methods

Non-integer parameter sample from discrete prior

Hey!

first, thanks a lot for this package! I was particular happy to see the support for (mixed continuous/) discrete priors, and the smc method seems to work well in my initial runs so far. However, I noticed a potential bug when using the ABCDE method (not yet released, current master branch of KissABC v3.0.1). When using a discrete prior the parameters from that prior are (sometimes) non-integer values (in contrast to smc).

Would be awesome if someone could take a look, as I'm excited to try out also the DE method!
The following code produces the behaviour for me (Julia 1.6, macOS, Distributions v0.23.12):

using KissABC
using Distributions
using Random

Random.seed!(1)
const p1 = 80.0
const p2 = 10.0
const targetdata = rand(Normal(p1, p2), 1000)

function dist((μ,σ))
    # isinteger(μ) && @info("Indeed integer ", μ)
    # isinteger(μ) || @warn("Found non-integer ", μ)

    # Int() will throw error
    simdata = rand(Normal(Int(μ),σ), 1000)
    d1 = mean(simdata) - mean(targetdata)
    d2 = std(simdata) - std(targetdata)
    hypot(d1, d2)
end

# mixed discrete/continuous prior
const prior=Factored(DiscreteUniform(0.0, 200.0), Uniform(0.0, 50.0))

# smc runs fine
const res_smc = smc(prior, dist, verbose=true)

# ABCDE throws error like InexactError: Int64(22.32...)
const res_DE = ABCDE(prior, dist, 0.3, nparticles=100, generations=100)

Best

Possible to combine simulate and loss functions?

Hi,

Thanks for the great package. Is it possible to create an interface that combines the simulate and distance functions into one function that is evaluating at inputs and returns real numbers? Is there a workaround I can use for this?

My loss function is quite complex and separating the simulation from the distance, while possible, just makes my code more complex.

Before the most recent patch, I was able to work around this as the distance always used the second argument for tdata, but that seems to have changed.

Thanks!

Precompiling error

Hello,

I receive the following error when entering the command 'using KissABC':

┌ Info: Precompiling KissABC [9c9dad79-530a-4643-a18b-2704674d4108]
└ @ Base loading.jl:1273
ERROR: LoadError: LoadError: syntax: "$" expression outside quote
Stacktrace:
[1] top-level scope at /home/trystan/.julia/packages/KissABC/lBWGp/src/smc.jl:37
[2] include at ./boot.jl:328 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1105
[4] include at ./Base.jl:31 [inlined]
[5] include(::String) at /home/trystan/.julia/packages/KissABC/lBWGp/src/KissABC.jl:1
[6] top-level scope at /home/trystan/.julia/packages/KissABC/lBWGp/src/KissABC.jl:19
[7] include at ./boot.jl:328 [inlined]
[8] include_relative(::Module, ::String) at ./loading.jl:1105
[9] include(::Module, ::String) at ./Base.jl:31
[10] top-level scope at none:2
[11] eval at ./boot.jl:330 [inlined]
[12] eval(::Expr) at ./client.jl:425
[13] top-level scope at ./none:3
in expression starting at /home/trystan/.julia/packages/KissABC/lBWGp/src/smc.jl:37
in expression starting at /home/trystan/.julia/packages/KissABC/lBWGp/src/KissABC.jl:19

Failed to precompile KissABC [9c9dad79-530a-4643-a18b-2704674d4108] to /home/trystan/.julia/compiled/v1.3/KissABC/zwuvb_AWArx.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1283
[3] _require(::Base.PkgId) at ./loading.jl:1024
[4] require(::Base.PkgId) at ./loading.jl:922
[5] require(::Module, ::Symbol) at ./loading.jl:917
[6] top-level scope at In[52]:1

Do you have any ideas how to resolve this?
Cheers

Ignore function evaluations that return Inf (or NaN)

When I train ODE models, some parameter combinations tend to cause the solution to be too stiff, which causes the solver to exit early and return an error.

Usually, when this happens I return a cost of Inf and which regular parameter optimization, the solution is ignored.

However, for some of the Bayesian parameter estimation algorithms that value is kept and it seems to prevent the algorithm from converging (range_\epsilon = (x, Inf)` for instance).

Would it be possible to add a mode that just discards that point?

Thank you

Factored prior over multivariate distributions

Thanks for this package! At the moment, the Factored distribution only applies to UnivariateDistributions. Is there any reason currently the code does not support MultivariateDistribution?

The reason I am interested here is that I would like to estimate transition matrices using ABC. In this setting, the appropriate choice of prior would be a Dirichlet distribution for each row of the transition matrix. Then the prior over transition matrices should be something like

Factored([Dirichlet(zeros(N)) for _ in eachrow(P)]).

As a hack, I've just extended the Factored type to allow MultivariateDistribution. This seems to work as-is. Would be curious to see whether this is something that can be incorporated into the package. https://github.com/zsteve/KissABC.jl/tree/multivariatefactor

References to ABC methods

Would you mind adding the literature references to both ABC algorithms to the documentation?

In particular, I could not find the reference to the SMC-ABC paper by Turner.

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.