Git Product home page Git Product logo

Comments (5)

min-nguyen avatar min-nguyen commented on June 2, 2024 2

I think the model itself is a bit problematic, e.g. an observation of 5 may be provided to a distribution like binomial(4, 0.5), where the log-density would be -Infinity. I've managed to "resolve" this by using a normal distribution rather than a Binomial one. I wonder if there's a way to not have to do this; anyway, I really appreciate the help, thanks again.

from gen.jl.

ztangent avatar ztangent commented on June 2, 2024 2

Ah yes, if your observations have support over all the positive integers and zero, then binomial is not a great choice for the observation noise distribution! Doing inference assuming a binomial would require some solving a non-trivial constraint satisfaction problem, e.g. given that the observation was 5 at timestep 6, what possible sequence of dXs could have been sampled, such that the problem of observing 5 was non-zero?

Black-box VI can't automatically solve that problem for you -- though I believe traditional forward-backward HMM algorithms should be able to, because they enumerate over all possibilities!

from gen.jl.

ztangent avatar ztangent commented on June 2, 2024 2

Incidentally, there is some specialized code in this Gen extension library that I believe supports the forward-backward algorithm for HMMs --- I believe it assumes that the model has no continuous variables, but you may be able to use it within a larger model to estimate the parameters that you're interested in!

https://github.com/probcomp/GenVariableElimination.jl

from gen.jl.

ztangent avatar ztangent commented on June 2, 2024

Hi @min-nguyen! I don't think there's an easy way to enforce constraints directly -- that would probably require a constrained optimization / gradient descent algorithm that we don't currently have implemented.

Have you considered parameterizing your guide distribution in terms of the log of the parameter you care about instead? For example:

@gen function hmmGuide(T::Int)
  @param log_trans_p_a
  @param log_trans_p_b
  @param log_obs_p_a
  @param log_obs_p_b
  trans_p = @trace(beta(exp(log_trans_p_a), exp(log_trans_p_b)), :trans_p)
  obs_p   = @trace(beta(exp(log_obs_p_a), exp(log_obs_p_b)), :obs_p)
end

I'm pretty sure this should avoid the issues you're running into, though I can't be certain without trying myself!

from gen.jl.

min-nguyen avatar min-nguyen commented on June 2, 2024

Ah that makes perfect sense, thanks! Unfortunately, I still run into the same error; I'm very confused.

I've tried using the same exp pattern in the model itself, as well as changing the init_params to larger floats.

I think this is originating from the objective becoming negative infinity.
est objective: -Inf

from gen.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.