/// <summary> /// Predictive Variance at a given point /// </summary> /// <param name="X">Input</param> /// <returns>Predictive variance</returns> public double Variance(Vector X) { if (IsUniform()) { Gaussian temp = new Gaussian(); temp.SetToUniform(); return(temp.GetVariance()); } else { Vector kxB = FixedParameters.KernelOf_X_B(X); return(FixedParameters.Prior.Variance(X) - Beta.QuadraticForm(kxB)); } }
/// <summary> /// Predictive distribution at a given point /// </summary> /// <param name="X">Input</param> /// <returns>Predictive distribution</returns> public Gaussian Marginal(Vector X) { if (IsUniform()) { return(Gaussian.Uniform()); } else { double kxx = FixedParameters.Prior.Variance(X); Vector kxb = FixedParameters.KernelOf_X_B(X); Gaussian result = new Gaussian( kxb.Inner(Alpha) + FixedParameters.Prior.Mean(X), kxx - Beta.QuadraticForm(kxb)); return(result); } }