See Helper_functions.laplacesmooth: update laplacesmooth as per code written in condprobve or lmeestimateparams.
def laplacesmooth(bn):
for vertex in bn.V:
numBins = bn.Vdata[vertex]['numoutcomes']
if not (bn.Vdata[vertex]["parents"]): # has no parents
for i in range(len(bn.Vdata[vertex]['cprob'])):
bn.Vdata[vertex]['cprob'][i][0] += 1 # numerator (count)
bn.Vdata[vertex]['cprob'][i][1] += numBins # denominator (total count)
else:
for i in range(numBins):
binindex = [str(float(i))]
bincounts = bn.Vdata[vertex]['cprob'][str(binindex)]
for j in range(len(bincounts)):
bincounts[j][0] += 1 # numerator (count)
bincounts[j][1] += numBins # denominator (total count)
return bn
See
Helper_functions.laplacesmooth
: update laplacesmooth as per code written in condprobve or lmeestimateparams.