VariableArray with mixed observed and random entries

已答复 VariableArray with mixed observed and random entries

  • 2012년 1월 23일 월요일 오전 10:08
     
     

    Hi,

    Is it possible to set a subset of entries of a VariableArray to observed values, and keep the rest random? 

    I tried a few ways (Subarrays and switching between an entirely observed and entirely random VariableArray), but none worked.  I cannot use a standard C# array instead. 

    Nevena

모든 응답

  • 2012년 1월 23일 월요일 오후 5:01
     
     답변됨

    Where 'i' is a Range over your observation array and 'indices' is an array of the entries to observe:

    Variable.ConstrainEqual(array[indices[i]], obs[i]);

    • 답변으로 표시됨 Nevena Lazic 2012년 1월 24일 화요일 오후 5:55
    •  
  • 2012년 1월 24일 화요일 오전 9:20
     
     

    Thanks.  I tried that as well, and compilation failed.  The problem might be that I'm indexing the CPT of X ("array") with X:

    using (Variable.ForEach(D))

            using (Variable.ForEach(N))

            using (Variable.Switch(G[D]))

            using (Variable.Switch(X[G[D]][N]))

                        X[D][N] = Variable.Discrete(cptX [D] [X[G[D]][N]] );

     

    The error is: Could not find a match for X[index2][N] in GateBlock.