3 ms·
I agree, you could learn so much just looking at how he defines functions.. see this for example: def pdist(counter): "Make a probability distribut
by drc0 10y ago
I agree, you could learn so much just looking at how he defines functions.. see this for example:
def pdist(counter):
"Make a probability distribution, given evidence from a Counter."
N = sum(counter.values())
return lambda x: counter[x]/N
P = pdist(COUNTS)
from http://nbviewer.jupyter.org/url/norvig.com/ipython/How%20to%20Do%20Things%20with%20Words.ipynb#%284%29-Theory:-From-Counts-to-Probabilities-of-Word-Sequences http://nbviewer.jupyter.org/url/norvig.com/ipython/How%20to%...