Things to do:
% conda create -n nlp21 jupyter jupyterlab nltk matplotlib scikit-learn scipy % conda activate nlp21
The 10 most common types cover almost 1/3 of the tokens, the top 1,000 cover just over 2/3.What do you observe on the much smaller big.txt corpus?
A Python decorator is any callable Python object that is used to modify a function, method or class definition. A decorator is passed the original object being defined and returns a modified object, which is then bound to the name in the definition. Python decorators were inspired in part by Java annotations, and have a similar syntax; the decorator syntax is pure syntactic sugar, using @ as the keyword:@viking_chorus def menu_item(): print("spam")is equivalent to:def menu_item(): print("spam") menu_item = viking_chorus(menu_item)
Install PyTorch: follow instructions from pytorch.org and follow the instructions for your OS (Linux, MacOS, Windows). If you have an nVidia GPU on your machine, select the appropriate CUDA version that you have installed.
Things to do:
Things to do:
import numpy as np import matplotlib.pyplot as plt s = np.random.dirichlet((10, 5, 3), 20).transpose() plt.barh(range(20), s[0]) plt.barh(range(20), s[1], left=s[0], color='g') plt.barh(range(20), s[2], left=s[0]+s[1], color='r') plt.title("Lengths of Strings") plt.show()(About 2 hours)
μ ~ k1Beta(a, b) + k2Beta(c, d) where k1 + k2 = 1 m ~ Bin(μ N)A prior over μ of this form is called a mixture prior - as it is a linear combination of simple priors.