Пример #1
0
def get_log_upper_proba_distribution_gp(gaussian_process: GaussianProcess,
                                        theta: np.ndarray):
    """
    This functions evaluates log( p_1(theta | X, y) ) where:
     - p_1 = Z * p
     - p is the posterior distribution
     - p_1 is easy to calculate

    There are 2 methods that you might find useful in the class GaussianProcess:
    - get_log_marginal_likelihood
    - get_log_prior_at

    :param gaussian_process
    :param theta: parameters at which we evaluate p_1. In our example, it is a numpy array (row vector)
    of shape (6,). As our linear + gaussian kernel depends on 6 real numbers.
    :return: log( p_1(theta | X, y) )
    """
    # TODO

    log_marginal_likelihood = gaussian_process.get_log_marginal_likelihood(
        *theta)
    log_prior = gaussian_process.get_log_prior_at(*theta)

    return log_marginal_likelihood + log_prior