function [Objective, SD] = predictObjective(this, XTable)
%PREDICTOBJECTIVE Predict the Objective function at a
%set of points.
%   [Objective, SD] = predictObjective(Results, XTable)
%   returns the posterior mean and standard deviation of the
%   objective function at the points in XTable, according to a
%   Gaussian Process model. Objective and SD are both N-by-1
%   vectors, given N rows of XTable.
%

%   Copyright 2016-2022 The MathWorks, Inc.

C = bayesoptim.suppressWarnings();
XTable = checkAndPrepareTableForPrediction(this, XTable, 'predictObjective');
if isempty(XTable)
    Objective = [];
    SD = [];
elseif isempty(this.ObjectiveFcnModel)
    Objective = NaN(height(XTable),1);
    SD = NaN(height(XTable),1);
else
    [Objective, SD] = predict(this.ObjectiveFcnModel, transformPoints(this, XTable));
end
end
