/// <summary>VMP message to <c>probTrue</c>.</summary> /// <param name="sample">Incoming message from <c>sample</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except <c>probTrue</c>. The formula is <c>exp(sum_(sample) p(sample) log(factor(sample,probTrue)))</c>.</para> /// </remarks> public static SparseBetaList ProbTrueAverageLogarithm(BernoulliIntegerSubset sample, SparseBetaList result) { result.SetToFunction(sample.SparseBernoulliList, s => BernoulliFromBetaOp.ProbTrueAverageLogarithm(s)); return(result); }
/// <summary>VMP message to <c>probTrue</c>.</summary> /// <param name="sample">Constant value for <c>sample</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the factor viewed as a function of <c>probTrue</c> conditioned on the given values.</para> /// </remarks> public static SparseBetaList ProbTrueAverageLogarithm(ISparseList <bool> sample, SparseBetaList result) { result.SetToFunction(sample, s => BernoulliFromBetaOp.ProbTrueAverageLogarithm(s)); return(result); }
/// <summary>VMP message to <c>probTrue</c>.</summary> /// <param name="sample">Constant value for <c>sample</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the factor viewed as a function of <c>probTrue</c> conditioned on the given values.</para> /// </remarks> public static SparseBetaList ProbTrueAverageLogarithm(IList <int> sample, SparseBetaList result) { result.SetToFunction(BernoulliIntegerSubset.SubsetToList(sample, result.Count), s => BernoulliFromBetaOp.ProbTrueAverageLogarithm(s)); return(result); }
/// <summary>VMP message to <c>sample</c>.</summary> /// <param name="probTrue">Incoming message from <c>probTrue</c>. Must be a proper distribution. If any element is uniform, the result will be uniform.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the exponential of the average log-factor value, where the average is over all arguments except <c>sample</c>. The formula is <c>exp(sum_(probTrue) p(probTrue) log(factor(sample,probTrue)))</c>.</para> /// </remarks> /// <exception cref="ImproperMessageException"> /// <paramref name="probTrue" /> is not a proper distribution.</exception> public static SparseBernoulliList SampleAverageLogarithm([SkipIfUniform] SparseBetaList probTrue, SparseBernoulliList result) { result.SetToFunction(probTrue, pt => BernoulliFromBetaOp.SampleAverageLogarithm(pt)); return(result); }
/// <summary>VMP message to <c>sample</c>.</summary> /// <param name="probTrue">Constant value for <c>probTrue</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the factor viewed as a function of <c>sample</c> conditioned on the given values.</para> /// </remarks> public static SparseBernoulliList SampleAverageLogarithm(ISparseList <double> probTrue, SparseBernoulliList result) { result.SetToFunction(probTrue, pt => BernoulliFromBetaOp.SampleAverageLogarithm(pt)); return(result); }
/// <summary>EP message to <c>probTrue</c>.</summary> /// <param name="sample">Incoming message from <c>sample</c>. Must be a proper distribution. If any element is uniform, the result will be uniform.</param> /// <param name="probTrue">Incoming message from <c>probTrue</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is a distribution matching the moments of <c>probTrue</c> as the random arguments are varied. The formula is <c>proj[p(probTrue) sum_(sample) p(sample) factor(sample,probTrue)]/p(probTrue)</c>.</para> /// </remarks> /// <exception cref="ImproperMessageException"> /// <paramref name="sample" /> is not a proper distribution.</exception> public static SparseBetaList ProbTrueAverageConditional([SkipIfUniform] SparseBernoulliList sample, SparseBetaList probTrue, SparseBetaList result) { result.SetToFunction(sample, probTrue, (s, pt) => BernoulliFromBetaOp.ProbTrueAverageConditional(s, pt)); return(result); }
/// <summary>Gibbs message to <c>probTrue</c>.</summary> /// <param name="sample">Constant value for <c>sample</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the factor viewed as a function of <c>probTrue</c> conditioned on the given values.</para> /// </remarks> public static SparseBetaList ProbTrueConditional(ISparseList <bool> sample, SparseBetaList result) { result.SetToFunction(sample, s => BernoulliFromBetaOp.ProbTrueConditional(s)); return(result); }
/// <summary>Gibbs message to <c>sample</c>.</summary> /// <param name="probTrue">Constant value for <c>probTrue</c>.</param> /// <param name="result">Modified to contain the outgoing message.</param> /// <returns> /// <paramref name="result" /> /// </returns> /// <remarks> /// <para>The outgoing message is the factor viewed as a function of <c>sample</c> conditioned on the given values.</para> /// </remarks> public static SparseBernoulliList SampleConditional(ISparseList <double> probTrue, SparseBernoulliList result) { result.SetToFunction(probTrue, pt => BernoulliFromBetaOp.SampleConditional(pt)); return(result); }