/// <summary> /// Tests EP and BP gate enter ops for Bernoulli random variable for correctness given message parameters. /// </summary> /// <param name="valueProbTrue">Probability of being true for the variable entering the gate.</param> /// <param name="enterOneProbTrue">Probability of being true for the variable approximation inside the gate when the selector is true.</param> /// <param name="selectorProbTrue">Probability of being true for the selector variable.</param> private void DoBernoulliEnterTest(double valueProbTrue, double enterOneProbTrue, double selectorProbTrue) { var value = new Bernoulli(valueProbTrue); var enterOne = new Bernoulli(enterOneProbTrue); var selector = new Bernoulli(selectorProbTrue); var selectorInverse = new Bernoulli(selector.GetProbFalse()); var discreteSelector = new Discrete(selector.GetProbTrue(), selector.GetProbFalse()); var discreteSelectorInverse = new Discrete(selector.GetProbFalse(), selector.GetProbTrue()); var cases = new[] { Bernoulli.FromLogOdds(selector.GetLogProbTrue()), Bernoulli.FromLogOdds(selector.GetLogProbFalse()) }; // Compute expected message double logShift = enterOne.GetLogNormalizer() + value.GetLogNormalizer() - (value * enterOne).GetLogNormalizer(); double expectedProbTrue = selector.GetProbFalse() + (selector.GetProbTrue() * enterOne.GetProbTrue() * Math.Exp(logShift)); double expectedProbFalse = selector.GetProbFalse() + (selector.GetProbTrue() * enterOne.GetProbFalse() * Math.Exp(logShift)); double expectedNormalizer = expectedProbTrue + expectedProbFalse; expectedProbTrue /= expectedNormalizer; Bernoulli value1, value2; // Enter partial (bernoulli selector, first case) value1 = GateEnterPartialOp <bool> .ValueAverageConditional( new[] { enterOne }, selector, value, new[] { 0 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialOp.ValueAverageConditional( new[] { enterOne }, selector, value, new[] { 0 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial (bernoulli selector, second case) value1 = GateEnterPartialOp <bool> .ValueAverageConditional( new[] { enterOne }, selectorInverse, value, new[] { 1 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialOp.ValueAverageConditional( new[] { enterOne }, selectorInverse, value, new[] { 1 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial (bernoulli selector, both cases) value1 = GateEnterPartialOp <bool> .ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, selector, value, new[] { 0, 1 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialOp.ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, selector, value, new[] { 0, 1 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial (discrete selector, first case) value1 = GateEnterPartialOp <bool> .ValueAverageConditional( new[] { enterOne }, discreteSelector, value, new[] { 0 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialOp.ValueAverageConditional( new[] { enterOne }, discreteSelector, value, new[] { 0 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial (discrete selector, second case) value1 = GateEnterPartialOp <bool> .ValueAverageConditional( new[] { enterOne }, discreteSelectorInverse, value, new[] { 1 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialOp.ValueAverageConditional( new[] { enterOne }, discreteSelectorInverse, value, new[] { 1 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial (discrete selector, both cases) value1 = GateEnterPartialOp <bool> .ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, discreteSelector, value, new[] { 0, 1 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialOp.ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, discreteSelector, value, new[] { 0, 1 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter one (discrete selector, first case) value1 = GateEnterOneOp <bool> .ValueAverageConditional( enterOne, discreteSelector, value, 0, new Bernoulli()); value2 = BeliefPropagationGateEnterOneOp.ValueAverageConditional( enterOne, discreteSelector, value, 0, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter one (discrete selector, second case) value1 = GateEnterOneOp <bool> .ValueAverageConditional( enterOne, discreteSelectorInverse, value, 1, new Bernoulli()); value2 = BeliefPropagationGateEnterOneOp.ValueAverageConditional( enterOne, discreteSelectorInverse, value, 1, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial two (first case) value1 = GateEnterPartialTwoOp.ValueAverageConditional( new[] { enterOne }, cases[0], cases[1], value, new[] { 0 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialTwoOp.ValueAverageConditional( new[] { enterOne }, cases[0], cases[1], value, new[] { 0 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial two (second case) value1 = GateEnterPartialTwoOp.ValueAverageConditional( new[] { enterOne }, cases[1], cases[0], value, new[] { 1 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialTwoOp.ValueAverageConditional( new[] { enterOne }, cases[1], cases[0], value, new[] { 1 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter partial two (both cases) value1 = GateEnterPartialTwoOp.ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, cases[0], cases[1], value, new[] { 0, 1 }, new Bernoulli()); value2 = BeliefPropagationGateEnterPartialTwoOp.ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, cases[0], cases[1], value, new[] { 0, 1 }, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); // Enter (discrete selector) value1 = GateEnterOp <bool> .ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, discreteSelector, value, new Bernoulli()); value2 = BeliefPropagationGateEnterOp.ValueAverageConditional( new[] { enterOne, Bernoulli.Uniform() }, discreteSelector, value, new Bernoulli()); Assert.Equal(expectedProbTrue, value1.GetProbTrue(), 1e-4); Assert.Equal(expectedProbTrue, value2.GetProbTrue(), 1e-4); }
/// <summary>Computations that depend on the observed value of numberOfIterationsDecreased and vGamma__1 and vGaussian__1 and vDirichlet1</summary> /// <param name="numberOfIterations">The number of times to iterate each loop</param> private void Changed_numberOfIterationsDecreased_vGamma__1_vGaussian__1_vDirichlet1(int numberOfIterations) { if (this.Changed_numberOfIterationsDecreased_vGamma__1_vGaussian__1_vDirichlet1_iterationsDone == numberOfIterations) { return; } // Create array for 'vdouble__3_marginal' Forwards messages. this.vdouble__3_marginal_F = new DistributionStructArray <Gaussian, double>(2); for (int index2 = 0; index2 < 2; index2++) { this.vdouble__3_marginal_F[index2] = Gaussian.Uniform(); } this.vVector1_marginal_F = ArrayHelper.MakeUniform <Dirichlet>(this.VDirichlet1); Discrete vint9_F = ArrayHelper.MakeUniform <Discrete>(Discrete.Uniform(2)); Discrete[] vint9_selector_uses_B = default(Discrete[]); // Create array for 'vint9_selector_uses' Backwards messages. vint9_selector_uses_B = new Discrete[3]; for (int _ind = 0; _ind < 3; _ind++) { vint9_selector_uses_B[_ind] = ArrayHelper.MakeUniform <Discrete>(Discrete.Uniform(2)); } DistributionStructArray <Bernoulli, bool>[] vint9_selector_cases_uses_B = default(DistributionStructArray <Bernoulli, bool>[]); // Create array for 'vint9_selector_cases_uses' Backwards messages. vint9_selector_cases_uses_B = new DistributionStructArray <Bernoulli, bool> [2]; for (int _ind = 0; _ind < 2; _ind++) { // Create array for 'vint9_selector_cases_uses' Backwards messages. vint9_selector_cases_uses_B[_ind] = new DistributionStructArray <Bernoulli, bool>(2); for (int _iv = 0; _iv < 2; _iv++) { vint9_selector_cases_uses_B[_ind][_iv] = Bernoulli.Uniform(); } } DistributionStructArray <Bernoulli, bool>[] vint9_selector_cases_depth1_uses_B = default(DistributionStructArray <Bernoulli, bool>[]); // Create array for 'vint9_selector_cases_depth1_uses' Backwards messages. vint9_selector_cases_depth1_uses_B = new DistributionStructArray <Bernoulli, bool> [2]; for (int _iv = 0; _iv < 2; _iv++) { // Create array for 'vint9_selector_cases_depth1_uses' Backwards messages. vint9_selector_cases_depth1_uses_B[_iv] = new DistributionStructArray <Bernoulli, bool>(10); for (int _ind = 0; _ind < 10; _ind++) { vint9_selector_cases_depth1_uses_B[_iv][_ind] = Bernoulli.Uniform(); } } // Create array for replicates of 'vdouble17__index2__F' DistributionStructArray <Gaussian, double> vdouble17__index2__F = new DistributionStructArray <Gaussian, double>(2); for (int index2 = 0; index2 < 2; index2++) { vdouble17__index2__F[index2] = Gaussian.Uniform(); } // Message from use of 'vdouble17' Gaussian vdouble17_use_B = Gaussian.Uniform(); // Message to marginal of 'vdouble17__index2_' // Create array for replicates of 'vdouble17__index2__marginal_F' DistributionStructArray <Gaussian, double> vdouble17__index2__marginal_F = new DistributionStructArray <Gaussian, double>(2); for (int index2 = 0; index2 < 2; index2++) { vdouble17__index2__marginal_F[index2] = Gaussian.Uniform(); } // Create array for replicates of 'vdouble__4_index2__B' DistributionStructArray <Gamma, double> vdouble__4_index2__B = new DistributionStructArray <Gamma, double>(2); for (int index2 = 0; index2 < 2; index2++) { vdouble__4_index2__B[index2] = Gamma.Uniform(); } // Create array for 'vdouble__4_marginal' Forwards messages. this.vdouble__4_marginal_F = new DistributionStructArray <Gamma, double>(2); for (int index2 = 0; index2 < 2; index2++) { this.vdouble__4_marginal_F[index2] = Gamma.Uniform(); } DistributionStructArray <Bernoulli, bool> vint9_selector_cases_depth1_B = default(DistributionStructArray <Bernoulli, bool>); // Create array for 'vint9_selector_cases_depth1' Backwards messages. vint9_selector_cases_depth1_B = new DistributionStructArray <Bernoulli, bool>(2); for (int _iv = 0; _iv < 2; _iv++) { vint9_selector_cases_depth1_B[_iv] = Bernoulli.Uniform(); } DistributionStructArray <Bernoulli, bool> vint9_selector_cases_B = default(DistributionStructArray <Bernoulli, bool>); // Create array for 'vint9_selector_cases' Backwards messages. vint9_selector_cases_B = new DistributionStructArray <Bernoulli, bool>(2); for (int _iv = 0; _iv < 2; _iv++) { vint9_selector_cases_B[_iv] = Bernoulli.Uniform(); } this.vint9_marginal_F = ArrayHelper.MakeUniform <Discrete>(Discrete.Uniform(2)); // Create array for replicates of 'vdouble__3_index2__B' DistributionStructArray <Gaussian, double> vdouble__3_index2__B = new DistributionStructArray <Gaussian, double>(2); for (int index2 = 0; index2 < 2; index2++) { vdouble__3_index2__B[index2] = Gaussian.Uniform(); // Message to 'vdouble__3_marginal' from Variable factor this.vdouble__3_marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gaussian>(this.vdouble__3_use_B[index2], this.VGaussian__1[index2], this.vdouble__3_marginal_F[index2]); // Message to 'vdouble__4_marginal' from Variable factor this.vdouble__4_marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gamma>(this.vdouble__4_use_B[index2], this.VGamma__1[index2], this.vdouble__4_marginal_F[index2]); // Message to 'vdouble17__index2_' from Gaussian factor vdouble17__index2__F[index2] = GaussianOp.SampleAverageLogarithm(this.vdouble__3_marginal_F[index2], this.vdouble__4_marginal_F[index2]); // Message to 'vdouble17__index2__marginal' from Variable factor vdouble17__index2__marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gaussian>(vdouble17_use_B, vdouble17__index2__F[index2], vdouble17__index2__marginal_F[index2]); } // Message to 'vVector1_marginal' from Variable factor this.vVector1_marginal_F = VariableVmpOp.MarginalAverageLogarithm <Dirichlet>(this.vVector1_use_B, this.VDirichlet1, this.vVector1_marginal_F); // Message to 'vint9' from Discrete factor vint9_F = DiscreteFromDirichletOp.SampleAverageLogarithm(this.vVector1_marginal_F, vint9_F); // Message to 'vint9_marginal' from Variable factor this.vint9_marginal_F = VariableVmpOp.MarginalAverageLogarithm <Discrete>(this.vint9_selector_B, vint9_F, this.vint9_marginal_F); for (int iteration = this.Changed_numberOfIterationsDecreased_vGamma__1_vGaussian__1_vDirichlet1_iterationsDone; iteration < numberOfIterations; iteration++) { for (int index2 = 0; index2 < 2; index2++) { // Message to 'vdouble__4_marginal' from Variable factor this.vdouble__4_marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gamma>(this.vdouble__4_use_B[index2], this.VGamma__1[index2], this.vdouble__4_marginal_F[index2]); // Message to 'vdouble__3_index2_' from Gaussian factor vdouble__3_index2__B[index2] = GaussianOp.MeanAverageLogarithm(vdouble17__index2__marginal_F[index2], this.vdouble__4_marginal_F[index2]); // Message to 'vdouble__3_use' from EnterOne factor this.vdouble__3_use_B[index2] = GateEnterOneOp <double> .ValueAverageLogarithm <Gaussian>(vdouble__3_index2__B[index2], this.vint9_marginal_F, index2, this.vdouble__3_use_B[index2]); // Message to 'vdouble__3_marginal' from Variable factor this.vdouble__3_marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gaussian>(this.vdouble__3_use_B[index2], this.VGaussian__1[index2], this.vdouble__3_marginal_F[index2]); // Message to 'vdouble17__index2_' from Gaussian factor vdouble17__index2__F[index2] = GaussianOp.SampleAverageLogarithm(this.vdouble__3_marginal_F[index2], this.vdouble__4_marginal_F[index2]); // Message to 'vdouble17__index2__marginal' from Variable factor vdouble17__index2__marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gaussian>(vdouble17_use_B, vdouble17__index2__F[index2], vdouble17__index2__marginal_F[index2]); // Message to 'vint9_selector_cases_depth1_uses' from Variable factor vint9_selector_cases_depth1_uses_B[index2][8] = Bernoulli.FromLogOdds(VariableVmpOp.AverageLogFactor <Gaussian>(vdouble17__index2__marginal_F[index2])); // Message to 'vint9_selector_cases_depth1_uses' from Gaussian factor vint9_selector_cases_depth1_uses_B[index2][7] = Bernoulli.FromLogOdds(GaussianOp.AverageLogFactor(vdouble17__index2__marginal_F[index2], this.vdouble__3_marginal_F[index2], this.vdouble__4_marginal_F[index2])); } for (int _iv = 0; _iv < 2; _iv++) { // Message to 'vint9_selector_cases_depth1' from Replicate factor vint9_selector_cases_depth1_B[_iv] = ReplicateOp.DefAverageLogarithm <Bernoulli>(vint9_selector_cases_depth1_uses_B[_iv], vint9_selector_cases_depth1_B[_iv]); // Message to 'vint9_selector_cases_uses' from Copy factor vint9_selector_cases_uses_B[0][_iv] = ArrayHelper.SetTo <Bernoulli>(vint9_selector_cases_uses_B[0][_iv], vint9_selector_cases_depth1_B[_iv]); } // Message to 'vint9_selector_cases' from Replicate factor vint9_selector_cases_B = ReplicateOp.DefAverageLogarithm <DistributionStructArray <Bernoulli, bool> >(vint9_selector_cases_uses_B, vint9_selector_cases_B); // Message to 'vint9_selector_uses' from CasesInt factor vint9_selector_uses_B[0] = IntCasesOp.IAverageLogarithm(vint9_selector_cases_B, vint9_selector_uses_B[0]); // Message to 'vint9_selector' from Replicate factor this.vint9_selector_B = ReplicateOp.DefAverageLogarithm <Discrete>(vint9_selector_uses_B, this.vint9_selector_B); // Message to 'vVector1_marginal' from Variable factor this.vVector1_marginal_F = VariableVmpOp.MarginalAverageLogarithm <Dirichlet>(this.vVector1_use_B, this.VDirichlet1, this.vVector1_marginal_F); // Message to 'vint9' from Discrete factor vint9_F = DiscreteFromDirichletOp.SampleAverageLogarithm(this.vVector1_marginal_F, vint9_F); // Message to 'vint9_marginal' from Variable factor this.vint9_marginal_F = VariableVmpOp.MarginalAverageLogarithm <Discrete>(this.vint9_selector_B, vint9_F, this.vint9_marginal_F); for (int index2 = 0; index2 < 2; index2++) { // Message to 'vdouble__4_index2_' from Gaussian factor vdouble__4_index2__B[index2] = GaussianOp.PrecisionAverageLogarithm(vdouble17__index2__marginal_F[index2], this.vdouble__3_marginal_F[index2]); // Message to 'vdouble__4_use' from EnterOne factor this.vdouble__4_use_B[index2] = GateEnterOneOp <double> .ValueAverageLogarithm <Gamma>(vdouble__4_index2__B[index2], this.vint9_marginal_F, index2, this.vdouble__4_use_B[index2]); } // Message to 'vVector1_use' from Discrete factor this.vVector1_use_B = DiscreteFromDirichletOp.ProbsAverageLogarithm(this.vint9_marginal_F, this.vVector1_use_B); this.OnProgressChanged(new ProgressChangedEventArgs(iteration)); } for (int index2 = 0; index2 < 2; index2++) { // Message to 'vdouble__3_index2_' from Gaussian factor vdouble__3_index2__B[index2] = GaussianOp.MeanAverageLogarithm(vdouble17__index2__marginal_F[index2], this.vdouble__4_marginal_F[index2]); // Message to 'vdouble__3_use' from EnterOne factor this.vdouble__3_use_B[index2] = GateEnterOneOp <double> .ValueAverageLogarithm <Gaussian>(vdouble__3_index2__B[index2], this.vint9_marginal_F, index2, this.vdouble__3_use_B[index2]); // Message to 'vdouble__3_marginal' from Variable factor this.vdouble__3_marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gaussian>(this.vdouble__3_use_B[index2], this.VGaussian__1[index2], this.vdouble__3_marginal_F[index2]); // Message to 'vint9_selector_cases_depth1_uses' from Gaussian factor vint9_selector_cases_depth1_uses_B[index2][7] = Bernoulli.FromLogOdds(GaussianOp.AverageLogFactor(vdouble17__index2__marginal_F[index2], this.vdouble__3_marginal_F[index2], this.vdouble__4_marginal_F[index2])); } for (int _iv = 0; _iv < 2; _iv++) { // Message to 'vint9_selector_cases_depth1' from Replicate factor vint9_selector_cases_depth1_B[_iv] = ReplicateOp.DefAverageLogarithm <Bernoulli>(vint9_selector_cases_depth1_uses_B[_iv], vint9_selector_cases_depth1_B[_iv]); // Message to 'vint9_selector_cases_uses' from Copy factor vint9_selector_cases_uses_B[0][_iv] = ArrayHelper.SetTo <Bernoulli>(vint9_selector_cases_uses_B[0][_iv], vint9_selector_cases_depth1_B[_iv]); } // Message to 'vint9_selector_cases' from Replicate factor vint9_selector_cases_B = ReplicateOp.DefAverageLogarithm <DistributionStructArray <Bernoulli, bool> >(vint9_selector_cases_uses_B, vint9_selector_cases_B); // Message to 'vint9_selector_uses' from CasesInt factor vint9_selector_uses_B[0] = IntCasesOp.IAverageLogarithm(vint9_selector_cases_B, vint9_selector_uses_B[0]); // Message to 'vint9_selector' from Replicate factor this.vint9_selector_B = ReplicateOp.DefAverageLogarithm <Discrete>(vint9_selector_uses_B, this.vint9_selector_B); // Message to 'vint9_marginal' from Variable factor this.vint9_marginal_F = VariableVmpOp.MarginalAverageLogarithm <Discrete>(this.vint9_selector_B, vint9_F, this.vint9_marginal_F); for (int index2 = 0; index2 < 2; index2++) { // Message to 'vdouble__4_index2_' from Gaussian factor vdouble__4_index2__B[index2] = GaussianOp.PrecisionAverageLogarithm(vdouble17__index2__marginal_F[index2], this.vdouble__3_marginal_F[index2]); // Message to 'vdouble__4_use' from EnterOne factor this.vdouble__4_use_B[index2] = GateEnterOneOp <double> .ValueAverageLogarithm <Gamma>(vdouble__4_index2__B[index2], this.vint9_marginal_F, index2, this.vdouble__4_use_B[index2]); // Message to 'vdouble__4_marginal' from Variable factor this.vdouble__4_marginal_F[index2] = VariableVmpOp.MarginalAverageLogarithm <Gamma>(this.vdouble__4_use_B[index2], this.VGamma__1[index2], this.vdouble__4_marginal_F[index2]); } // Message to 'vVector1_use' from Discrete factor this.vVector1_use_B = DiscreteFromDirichletOp.ProbsAverageLogarithm(this.vint9_marginal_F, this.vVector1_use_B); // Message to 'vVector1_marginal' from Variable factor this.vVector1_marginal_F = VariableVmpOp.MarginalAverageLogarithm <Dirichlet>(this.vVector1_use_B, this.VDirichlet1, this.vVector1_marginal_F); this.vdouble17_F = Gaussian.Uniform(); DistributionStructArray <Bernoulli, bool> vint9_selector_cases_F = default(DistributionStructArray <Bernoulli, bool>); // Create array for 'vint9_selector_cases' Forwards messages. vint9_selector_cases_F = new DistributionStructArray <Bernoulli, bool>(2); for (int _iv = 0; _iv < 2; _iv++) { vint9_selector_cases_F[_iv] = Bernoulli.Uniform(); } // Message to 'vint9_selector_cases' from CasesInt factor vint9_selector_cases_F = IntCasesOp.CasesAverageLogarithm <DistributionStructArray <Bernoulli, bool> >(this.vint9_marginal_F, vint9_selector_cases_F); // Message to 'vdouble17' from Exit factor this.vdouble17_F = GateExitOp <double> .ExitAverageLogarithm <Gaussian>(vint9_selector_cases_F, vdouble17__index2__marginal_F, this.vdouble17_F); this.Changed_numberOfIterationsDecreased_vGamma__1_vGaussian__1_vDirichlet1_iterationsDone = numberOfIterations; }