예제 #1
0
        /// <summary>Computations that do not depend on observed values</summary>
        public void Constant()
        {
            if (this.Constant_iterationsDone == 1)
            {
                return;
            }
            // The constant 'vBernoulli0'
            Bernoulli vBernoulli0 = Bernoulli.FromLogOdds(0);

            this.vbool0_marginal_F = ArrayHelper.MakeUniform <Bernoulli>(vBernoulli0);
            // Message from use of 'vbool0'
            Bernoulli vbool0_use_B = ArrayHelper.MakeUniform <Bernoulli>(vBernoulli0);

            // Message to 'vbool0_marginal' from Variable factor
            this.vbool0_marginal_F = VariableOp.MarginalAverageConditional <Bernoulli>(vbool0_use_B, vBernoulli0, this.vbool0_marginal_F);
            this.vbool1_marginal_F = ArrayHelper.MakeUniform <Bernoulli>(vBernoulli0);
            // Message from use of 'vbool1'
            Bernoulli vbool1_use_B = ArrayHelper.MakeUniform <Bernoulli>(vBernoulli0);

            // Message to 'vbool1_marginal' from Variable factor
            this.vbool1_marginal_F = VariableOp.MarginalAverageConditional <Bernoulli>(vbool1_use_B, vBernoulli0, this.vbool1_marginal_F);
            Bernoulli vbool2_F = ArrayHelper.MakeUniform <Bernoulli>(new Bernoulli());

            this.vbool2_marginal_F = ArrayHelper.MakeUniform <Bernoulli>(new Bernoulli());
            // Message from use of 'vbool2'
            Bernoulli vbool2_use_B = ArrayHelper.MakeUniform <Bernoulli>(new Bernoulli());

            // Message to 'vbool2' from And factor
            vbool2_F = BooleanAndOp.AndAverageConditional(vBernoulli0, vBernoulli0);
            // Message to 'vbool2_marginal' from DerivedVariable factor
            this.vbool2_marginal_F       = DerivedVariableOp.MarginalAverageConditional <Bernoulli>(vbool2_use_B, vbool2_F, this.vbool2_marginal_F);
            this.Constant_iterationsDone = 1;
        }
        /// <summary>Computations that depend on the observed value of firstCoin</summary>
        private void Changed_firstCoin()
        {
            if (this.Changed_firstCoin_isDone)
            {
                return;
            }
            this.firstCoin_marginal = Bernoulli.Uniform();
            this.firstCoin_marginal = Distribution.SetPoint <Bernoulli, bool>(this.firstCoin_marginal, this.FirstCoin);
            Bernoulli vBernoulli0 = Bernoulli.Uniform();
            Bernoulli bothHeads_F = default(Bernoulli);

            this.bothHeads_marginal_F = Bernoulli.Uniform();
            Bernoulli bothHeads_use_B = Bernoulli.Uniform();

            // Message to 'bothHeads' from And factor
            bothHeads_F = BooleanAndOp.AndAverageConditional(this.FirstCoin, vBernoulli0);
            // Message to 'bothHeads_marginal' from DerivedVariable factor
            this.bothHeads_marginal_F     = DerivedVariableOp.MarginalAverageConditional <Bernoulli>(bothHeads_use_B, bothHeads_F, this.bothHeads_marginal_F);
            this.Changed_firstCoin_isDone = true;
        }
예제 #3
0
        /// <summary>Computations that do not depend on observed values</summary>
        private void Constant()
        {
            if (this.Constant_isDone)
            {
                return;
            }
            Bernoulli vBernoulli0 = Bernoulli.Uniform();

            this.firstCoin_marginal_F  = Bernoulli.Uniform();
            this.secondCoin_marginal_F = Bernoulli.Uniform();
            Bernoulli bothHeads_F = default(Bernoulli);

            this.bothHeads_marginal_F = Bernoulli.Uniform();
            Bernoulli bothHeads_use_B = Bernoulli.Uniform();

            // Message to 'bothHeads' from And factor
            bothHeads_F = BooleanAndOp.AndAverageConditional(vBernoulli0, vBernoulli0);
            // Message to 'bothHeads_marginal' from DerivedVariable factor
            this.bothHeads_marginal_F = DerivedVariableOp.MarginalAverageConditional <Bernoulli>(bothHeads_use_B, bothHeads_F, this.bothHeads_marginal_F);
            this.Constant_isDone      = true;
        }
예제 #4
0
        /// <summary>Computations that do not depend on observed values</summary>
        private void Constant()
        {
            if (this.Constant_isDone)
            {
                return;
            }
            Bernoulli vBernoulli0 = Bernoulli.Uniform();

            this.vbool0_marginal_F = Bernoulli.Uniform();
            this.vbool1_marginal_F = Bernoulli.Uniform();
            Bernoulli vbool2_F = default(Bernoulli);

            this.vbool2_marginal_F = Bernoulli.Uniform();
            Bernoulli vbool2_use_B = Bernoulli.Uniform();

            // Message to 'vbool2' from And factor
            vbool2_F = BooleanAndOp.AndAverageConditional(vBernoulli0, vBernoulli0);
            // Message to 'vbool2_marginal' from DerivedVariable factor
            this.vbool2_marginal_F = DerivedVariableOp.MarginalAverageConditional <Bernoulli>(vbool2_use_B, vbool2_F, this.vbool2_marginal_F);
            this.Constant_isDone   = true;
        }