Is it possible to do inference on a chain model with unknown total length? RRS feed

  • Question

  • In the new offset indexing notation available in Infer.NET 2.6, is it possible to do inference on chain models when the length of the VariableArray representing the chain is not known in advance?

    As a simple example, consider the case of a Markov Chain or HMM where there is an "absorbing" state, and we observe some initial states or observations to the chain. Is it possible to calculate the average number of steps that this absorbing state would be reached, given our initial observations?

    From what I understand of the API, it wouldn't be possible to define a VariableArray with a random length that is dependent on the state of the chain - however, we could do something hacky where the chain is defined for a constant, but large number of states, define the absorbing state to replicate along the chain, and we could do manually compute the expected number of steps to reach this along the chain. This seems inefficient because the number of chain steps needed could be potentially very large, and the inference wouldn't be directly done by the engine.

    is there a better way to implement such a model, and perhaps an example? I've looked at the Chess Analysis example but it doesn't seem to apply for this case, because in it are a small number of fixed years over which all players' skills are defined.

    Thursday, January 22, 2015 4:47 PM


  • The best way to solve this in Infer.NET is to make a chain of fixed length and use length.ObservedValue to keep making it longer until the answer stabilizes.
    • Marked as answer by Andrew Mao Saturday, January 24, 2015 10:27 AM
    Friday, January 23, 2015 10:21 PM