Beispiel #1
0
		/// <summary>
		/// Evidence message for VMP
		/// </summary>
		/// <param name="sample">Incoming message from 'sample'.</param>
		/// <param name="mean">Constant value for 'mean'.</param>
		/// <returns>Average of the factor's log-value across the given argument distributions</returns>
		/// <remarks><para>
		/// The formula for the result is <c>sum_(sample) p(sample) log(factor(sample,mean))</c>.
		/// Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
		/// </para></remarks>
		public static double AverageLogFactor(Poisson sample, double mean)
		{
			return sample.GetMean() * mean - sample.GetMeanLogFactorial() - mean;
		}
Beispiel #2
0
 /// <summary>Evidence message for VMP.</summary>
 /// <param name="sample">Incoming message from <c>sample</c>.</param>
 /// <param name="mean">Constant value for <c>mean</c>.</param>
 /// <returns>Average of the factor's log-value across the given argument distributions.</returns>
 /// <remarks>
 ///   <para>The formula for the result is <c>sum_(sample) p(sample) log(factor(sample,mean))</c>. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.</para>
 /// </remarks>
 public static double AverageLogFactor(Poisson sample, double mean)
 {
     return(sample.GetMean() * mean - sample.GetMeanLogFactorial() - mean);
 }
Beispiel #3
0
		/// <summary>
		/// Evidence message for VMP
		/// </summary>
		/// <param name="sample">Incoming message from 'sample'.</param>
		/// <param name="mean">Incoming message from 'mean'. Must be a proper distribution.  If uniform, the result will be uniform.</param>
		/// <returns>Average of the factor's log-value across the given argument distributions</returns>
		/// <remarks><para>
		/// The formula for the result is <c>sum_(sample,mean) p(sample,mean) log(factor(sample,mean))</c>.
		/// Adding up these values across all factors and variables gives the log-evidence estimate for VMP.
		/// </para></remarks>
		/// <exception cref="ImproperMessageException"><paramref name="mean"/> is not a proper distribution</exception>
		public static double AverageLogFactor(Poisson sample, [Proper] Gamma mean)
		{
			return sample.GetMean() * mean.GetMeanLog() - sample.GetMeanLogFactorial() - mean.GetMean();
		}
Beispiel #4
0
 /// <summary>Evidence message for VMP.</summary>
 /// <param name="sample">Incoming message from <c>sample</c>.</param>
 /// <param name="mean">Incoming message from <c>mean</c>. Must be a proper distribution. If uniform, the result will be uniform.</param>
 /// <returns>Average of the factor's log-value across the given argument distributions.</returns>
 /// <remarks>
 ///   <para>The formula for the result is <c>sum_(sample,mean) p(sample,mean) log(factor(sample,mean))</c>. Adding up these values across all factors and variables gives the log-evidence estimate for VMP.</para>
 /// </remarks>
 /// <exception cref="ImproperMessageException">
 ///   <paramref name="mean" /> is not a proper distribution.</exception>
 public static double AverageLogFactor(Poisson sample, [Proper] Gamma mean)
 {
     return(sample.GetMean() * mean.GetMeanLog() - sample.GetMeanLogFactorial() - mean.GetMean());
 }