charles-river-analytics / figaro

Figaro Programming Language and Core Libraries
Other
756 stars 151 forks source link

Rare Event Handling in ParticleFilter Implementation #650

Closed ssbanerje closed 2 years ago

ssbanerje commented 7 years ago

Consider the ValveReliability example that is shipped along with Figaro. If any of the probabilities in f1, f2, or f3 were changed to so that there was several order of magnitude difference between the most likely and least likely event, ie.

Select(0.999999999 -> OK, 5E-10 -> RO, 5E-10-> RC)("f1", static)

then a sampling based filtering algorithm like the ParticleFilter will not be able to sample events that happen very rarely as they never get picked up and propagated. AFAIK the only way to get around this is by Importance sampling the particles to give a much higher weight to the less likely events.

As far as I understand, the standard Figaro ParticleFilter implements some form of the sequential importance sampling algorithm, but assigns weights only based on Observations/Conditions/Constraints (This also seems to be the case for the Importance sampler). Is there some way we can simulate rare event filtering/inference in Figaro?

apfeffer commented 7 years ago

Hi Subho,

Unfortunately, our particle filter only proposes samples by the prior, so you do run into the rare event issue. As you suggest, there are particle filtering algorithms that use different proposals, but it’s hard to design such an algorithm that works in a general way with probabilistic programming. This would be an interesting research project.

For filtering with rare events, you might want to look at our factored frontier algorithm (a form of BP for filtering). This doesn’t have the rare event problem because it doesn’t depend on sampling, so if BP works well for your problem, it could be a good alternative.

Avi

From: Subho Banerjee notifications@github.com Reply-To: p2t2/figaro reply@reply.github.com Date: Wednesday, December 14, 2016 at 1:55 PM To: p2t2/figaro figaro@noreply.github.com Subject: [p2t2/figaro] Rare Event Handling in ParticleFilter Implementation (#650)

Consider the ValveReliabilityhttps://github.com/p2t2/figaro/blob/master/FigaroExamples/src/main/scala/com/cra/figaro/example/ValveReliability.scala example that is shipped along with Figaro. If any of the probabilities in f1, f2, or f3 were changed to so that there was several order of magnitude difference between the most likely and least likely event, ie.

Select(0.999999999 -> OK, 5E-10 -> RO, 5E-10-> RC)("f1", static)

then a sampling based filtering algorithm like the ParticleFilter will not be able to sample events that happen very rarely as they never get picked up and propagated. AFAIK the only way to get around this is by Importance sampling the particles to give a much higher weight to the less likely events.

As far as I understand, the standard Figaro ParticleFilter implements some form of the sequential importance sampling algorithm, but assigns weights only based on Observations/Conditions/Constraints (This also seems to be the case for the Importance sampler). Is there some way we can simulate rare event filtering/inference in Figaro?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/p2t2/figaro/issues/650, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFJkd3MIhoyAfvtYgML1JqTrAOQTZe9-ks5rIDuugaJpZM4LNSDX.

ssbanerje commented 7 years ago

Hi Avi, Actually this question and #649 are sort of related. My model is a continuous time CTMC which has been uniformized to a DTMC. However, some of the states in the model are time dependent, and I have to keep the simulation time updated. When I try to use a continuous variable with the FactoredFrontier solver, it complains:

Warning: Sampling element Exponential(0.1) even though no sampler defined for this universe

Is there any way to get around that issue?

apfeffer commented 7 years ago

Hi Subho,

I’m sorry about the cryptic nature of this warning, which we are changing. This warning means that we’re using a factored algorithm, which is discrete, on a model with a continuous variable, and that the algorithm is sampling a discrete set of states for that variable. Unfortunately, we don’t currently have a way of applying factored algorithms to continuous variables without discretizing them.

Avi

From: Subho Banerjee notifications@github.com Reply-To: p2t2/figaro reply@reply.github.com Date: Wednesday, December 14, 2016 at 3:32 PM To: p2t2/figaro figaro@noreply.github.com Cc: Avi Pfeffer apfeffer@cra.com, Comment comment@noreply.github.com Subject: Re: [p2t2/figaro] Rare Event Handling in ParticleFilter Implementation (#650)

Hi Avi, Actually this question and #649https://github.com/p2t2/figaro/issues/649 are sort of related. My model is a continuous time CTMC which has been uniformized to a DTMC. However, some of the states in the model are time dependent, and I have to keep the simulation time updated. When I try to use a continuous variable with the FactoredFrontier solver, it complains:

Warning: Sampling element Exponential(0.1) even though no sampler defined for this universe

Is there any way to get around that issue?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/p2t2/figaro/issues/650#issuecomment-267148065, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFJkdyXNspGxin4JgMqgK6lRp49bxvGjks5rIFJWgaJpZM4LNSDX.