/:
def estimateProbability(priorProbs, buyCount, noBuyCount):
condProbs = [p**buyCount * (1.0-p)**noBuyCount for p in priorProbs]
normalize = 1.0 / sum(condProbs)
priorMeta = [normalize * cp for cp in condProbs]
return sum(pm * pp for pm, pp in zip(priorMeta, priorProbs))
def example(numProspects=4):
for bought in range(0, numProspects+1):
result = estimateProbability([0.3, 0.7], bought, numProspects-bought)
print 'b=%d, p=%.2f' % (bought, result)
example()
:
b=0, p=0.31
b=1, p=0.36
b=2, p=0.50
b=3, p=0.64
b=4, p=0.69
. , ; , , , , "", (p = 0.0), , - (p = 1.0) - , , , . , :
b=0, p=0.06
b=1, p=0.36
b=2, p=0.50
b=3, p=0.64
b=4, p=0.94
( , , , , - , , ), ( 0,0 1.0 , beforeWeights estimateProbability).
, , , Business Intelligence, ...! -)