.. index:: pair: class; gpr::ConditionalPosterior .. _doxid-classgpr_1_1_conditional_posterior: class gpr::ConditionalPosterior =============================== .. toctree:: :hidden: Overview ~~~~~~~~ Conditions a frozen GP posterior on disjoint new observation channels. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class ConditionalPosterior { public: // construction :target:`ConditionalPosterior`(Eigen::MatrixXd background_covariance, Eigen::VectorXd residual, Eigen::VectorXd noise_variance, std::shared_ptr<:ref:`linalg::DistributedState`> execution = {}); // methods bool :ref:`condition`(const Eigen::MatrixXd& active_covariance); Eigen::Index :target:`channels`() const; bool :ref:`conditionForLikelihood`(const Eigen::MatrixXd& active_covariance); void :ref:`prepareLocalPrediction`(); bool :target:`hasLocalPredictionFactor`() const; Eigen::Index :target:`localPredictionFactorStoredElementsForTesting`() const; const Eigen::VectorXd& :target:`residual`() const; const Eigen::MatrixXd& :ref:`backgroundCovariance`() const; bool :target:`valid`() const; const Eigen::VectorXd& :ref:`weights`() const; double :target:`negativeLogLikelihood`() const; double :ref:`negativeLogLikelihoodDerivative`(const Eigen::MatrixXd& covariance_derivative) const; Eigen::MatrixXd :ref:`negativeLogLikelihoodWeight`() const; Eigen::VectorXd :ref:`negativeLogLikelihoodDerivatives`(const std::vector& derivatives) const; double :ref:`negativeLogLeaveOneGeometryOut`(Eigen::Index geometry_rows) const; Eigen::VectorXd :ref:`predictMean`(const Eigen::VectorXd& background_mean, const Eigen::MatrixXd& cross_covariance) const; Eigen::MatrixXd :ref:`predictCovariance`(const Eigen::MatrixXd& query_prior, const Eigen::MatrixXd& cross_covariance) const; double :ref:`schurRelativeError`() const; Eigen::VectorXd :ref:`predictVariance`(const Eigen::VectorXd& query_prior, const Eigen::MatrixXd& cross_covariance) const; Eigen::MatrixXd :ref:`whitenPredictionCrossCovariance`(const Eigen::MatrixXd& cross_covariance) const; }; .. _details-classgpr_1_1_conditional_posterior: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Conditions a frozen GP posterior on disjoint new observation channels. The background covariance and residual y - m_background are fixed during an active-kernel fit. Only the new-channel covariance is factorized. Means, covariances and noise must use the same physical output units. Methods ------- .. index:: pair: function; condition .. _doxid-classgpr_1_1_conditional_posterior_1a29d853a38380c7f647b2cbfddf4da63a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool condition(const Eigen::MatrixXd& active_covariance) Fit an additive active kernel; a zero matrix gives exact sequential conditioning under the background kernel alone. False marks an invalid posterior and requires a feasible covariance before prediction. .. index:: pair: function; conditionForLikelihood .. _doxid-classgpr_1_1_conditional_posterior_1adb8b3a6bbcff7acd345931e7a3037849: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool conditionForLikelihood(const Eigen::MatrixXd& active_covariance) Collective likelihood evaluation and derivatives without replicating the factor. Call prepareLocalPrediction before local covariance or LOO. .. index:: pair: function; prepareLocalPrediction .. _doxid-classgpr_1_1_conditional_posterior_1ab2da8c6c247bacc3fa08206e0c503c6d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void prepareLocalPrediction() Collective transfer of the fitted factor for rank-local predictions. .. index:: pair: function; backgroundCovariance .. _doxid-classgpr_1_1_conditional_posterior_1a64ece36f1e7ca9d2483d8426024b7816: .. ref-code-block:: cpp :class: doxyrest-title-code-block const Eigen::MatrixXd& backgroundCovariance() const Latent background covariance before adding the correction and noise. .. index:: pair: function; weights .. _doxid-classgpr_1_1_conditional_posterior_1a1423278f52e0b32c863567609098351b: .. ref-code-block:: cpp :class: doxyrest-title-code-block const Eigen::VectorXd& weights() const Fitted coefficients in physical observation-channel order. .. index:: pair: function; negativeLogLikelihoodDerivative .. _doxid-classgpr_1_1_conditional_posterior_1ae34d323f28bc23c11d28f411c6d07ee9: .. ref-code-block:: cpp :class: doxyrest-title-code-block double negativeLogLikelihoodDerivative(const Eigen::MatrixXd& covariance_derivative) const d(-log p(y_new | D_background))/d theta for one active parameter. The caller forms only the derivatives selected for optimization. .. index:: pair: function; negativeLogLikelihoodWeight .. _doxid-classgpr_1_1_conditional_posterior_1a4139022550a2b6b940edb7fb5e0b50f7: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd negativeLogLikelihoodWeight() const One lexical precision contraction serves every selected parameter. With a process group, conditioning and this contraction are collective; prediction and geometry LOO consume the replicated lower factor locally. .. index:: pair: function; negativeLogLikelihoodDerivatives .. _doxid-classgpr_1_1_conditional_posterior_1a1698fc672088ffa26c50aa8ab3a0f1cd: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd negativeLogLikelihoodDerivatives(const std::vector& derivatives) const Parameter contractions share one precision weight at the fitted point. .. index:: pair: function; negativeLogLeaveOneGeometryOut .. _doxid-classgpr_1_1_conditional_posterior_1ae19b7cd23c2c98ba5c4cecef26b5fa80: .. ref-code-block:: cpp :class: doxyrest-title-code-block double negativeLogLeaveOneGeometryOut(Eigen::Index geometry_rows) const :ref:`Sum ` of whole-geometry LOO negative log predictive densities at fixed hyperparameters. Channel-major ordering groups indices r + c\*n_rows. .. index:: pair: function; predictMean .. _doxid-classgpr_1_1_conditional_posterior_1abd3d2220e908314591147737d458bb03: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd predictMean(const Eigen::VectorXd& background_mean, const Eigen::MatrixXd& cross_covariance) const Cross covariance is C_background(X,B) + K_active(X,B). .. index:: pair: function; predictCovariance .. _doxid-classgpr_1_1_conditional_posterior_1aa1590e21a23ebdedd0db65f4985c9886: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd predictCovariance(const Eigen::MatrixXd& query_prior, const Eigen::MatrixXd& cross_covariance) const Query prior is C_background(X,X) + K_active(X,X). :ref:`Observation ` noise is added by the caller only when a predictive, rather than latent, covariance is requested. .. index:: pair: function; schurRelativeError .. _doxid-classgpr_1_1_conditional_posterior_1aae3a1c9568be3a2edd5e0fda62a137c3: .. ref-code-block:: cpp :class: doxyrest-title-code-block double schurRelativeError() const Relative forward error of a Schur complement formed from this posterior's lower factor (:ref:`linalg::choleskySchurRelativeError `). Needs the replicated factor; the dense copy is made on the call. .. index:: pair: function; predictVariance .. _doxid-classgpr_1_1_conditional_posterior_1a83f594c36ae4e3be57e883c10c42aa5e: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::VectorXd predictVariance(const Eigen::VectorXd& query_prior, const Eigen::MatrixXd& cross_covariance) const Diagonal of the same conditional covariance without a query Gram matrix. .. index:: pair: function; whitenPredictionCrossCovariance .. _doxid-classgpr_1_1_conditional_posterior_1adc123e67584cf135fa817b0d3d6e7fdf: .. ref-code-block:: cpp :class: doxyrest-title-code-block Eigen::MatrixXd whitenPredictionCrossCovariance(const Eigen::MatrixXd& cross_covariance) const Columns are L^-1 C(B,X), so their inner products give the covariance reduction at selected query channels without an all-pairs Gram matrix.