You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: learn_params.m
    path of file: ./repos/bnt/BNT/CPDs/@generic_CPD
    
    the code of the file until where you have to start completion: function CPD = learn_params(CPD, fam, data, ns, cnodes)
% LEARN_PARAMS Compute the maximum likelihood estimate of the params of a generic CPD given complete data
% CPD = learn_params(CPD, fam, data, ns, cnodes)
%
% data(i,m) is the value of node i in case m (can be cell array).
% We assume this node has a maximize_params method.

%error('no longer supported') % KPM 1 Feb 03

if 1
ncases = size(data, 2);
CPD = reset_ess(CPD);
% make a fully observed joint distribution over the family
fmarginal.domain = fam;
fmarginal.T = 1;
fmarginal.mu = [];
fmarginal.Sigma = [];
if ~iscell(data)

    
function CPD = learn_params(CPD, fam, data, ns, cnodes)
% LEARN_PARAMS Compute the maximum likelihood estimate of the params of a generic CPD given complete data
% CPD = learn_params(CPD, fam, data, ns, cnodes)
%
% data(i,m) is the value of node i in case m (can be cell array).
% We assume this node has a maximize_params method.

%error('no longer supported') % KPM 1 Feb 03

if 1
ncases = size(data, 2);
CPD = reset_ess(CPD);
% make a fully observed joint distribution over the family
fmarginal.domain = fam;
fmarginal.T = 1;
fmarginal.mu = [];
fmarginal.Sigma = [];
if ~iscell(data)
  cases = num2cell(data);
else
  cases = data;
end