function bnode = maximize_params_tabular(bnode)
% MAXIMIZE_PARAMS_TABULAR Set the params of a tabular node to their ML/MAP values.
% bnode = maximize_params_tabular(bnode)

if ~bnode.adjustable, return; end

%assert(approxeq(sum(bnode.counts(:)),bnode.num_samples));
if ~approxeq(sum(bnode.counts(:)),bnode.num_samples)
  fprintf('node %d has incompatible counts\n', bnode.self);
end

bnode.CPT = bnode.counts + bnode.prior;
bnode.CPT = mk_stochastic(bnode.CPT);
