public TableFactor observe ( int variable , final int value ) { return marginalize ( variable , 0 , ( marginalizedVariableValue , assignment ) -> { if ( marginalizedVariableValue == value ) { return ( old , n ) -> { // This would mean that we're observing something with 0 probability, which will wonk up downstream // stuff // assert(n != 0); assert ! Double . isNaN ( n ) ; return n ; } ; } else { return ( old , n ) -> { assert ! Double . isNaN ( old ) ; return old ; } ; } } ) ; }
Remove a variable by observing it at a certain value return a new factor without that variable .