コード例 #1
0
ファイル: conditionals.py プロジェクト: shafiahmed/PAML
def _sample_conditional(Xnew,
                        feat,
                        kern,
                        f,
                        *,
                        full_output_cov=False,
                        q_sqrt=None,
                        white=False):
    """
    `sample_conditional` will return amplitude sample from the conditional distribution.
    In most cases this means calculating the conditional mean m and variance v and then
    returning m + sqrt(v) * eps, with eps ~ N(0, 1).
    However, for some combinations of Mok and Mof more efficient sampling routines exists.
    The dispatcher will make sure that we use the most efficient one.
    :return: N x P (full_output_cov = False) or N x P x P (full_output_cov = True)
    """
    logger.debug("sample conditional: InducingFeature Kernel")
    mean, var = conditional(Xnew,
                            feat,
                            kern,
                            f,
                            full_cov=False,
                            full_output_cov=full_output_cov,
                            q_sqrt=q_sqrt,
                            white=white)  # N x P, N x P (x P)
    cov_structure = "full" if full_output_cov else "diag"
    return _sample_mvn(mean, var, cov_structure)
コード例 #2
0
ファイル: conditionals.py プロジェクト: shafiahmed/PAML
def _sample_conditional(Xnew, X, kern, f, *, q_sqrt=None, white=False):
    logger.debug("sample conditional: Kernel")
    mean, var = conditional(Xnew,
                            X,
                            kern,
                            f,
                            q_sqrt=q_sqrt,
                            white=white,
                            full_cov=False)  # N x P, N x P
    return _sample_mvn(mean, var, "diag")  # N x P