Assignment 1


Along with your answer to each of these questions, please tell us roughly how long it took you to answer the question. This assignment is largely a reality check, to make sure you're comfortable with basic background and skills the course will require.

Question 1. After signing up on https://piazza.com/umd/spring2017/ling773cmsc773inst728c/, please complete this Google Survey. Although this assigment is not due until next class, it would be really helpful to get responses to the survey as soon as possible, ideally before the end of the weekend, since they could influence planning for upcoming lectures.


Question 2. In class we played a little bit with Amazon's "Alexa". It's a black box, but that doesn't mean we can't make inferences about its underlying capabilities. For each of the following, briefly explain what the term means in your own words (not just copy/pasting a definition), and suggest some things you could say to Alexa (which might include several turns of conversation if necessary, not just one) to explore which linguistic phenomena she does and does not handle (or handle well).

Here's an example of an answer if we were asking about coreference:

Coreference involves the use of terms that refer to other terms in an utterance or conversation, typically entities that have already been referrred to. Often this is accomplished using pronouns (e.g. "The professor gave out his first assignment and it was really interesting), but definite references (e.g. "that professor") can also be used to co-refer. Here are some things we could say to Alexa to explore her co-reference capabilities:

Alexa, when was George Washington born?

(Alexa answers)

Alexa, when did he die?

This will test whether Alexa handles (some) coreference to named entities. We could also ask "When did she die", to see whether coreference is paying attention to pronoun gender distinctions (masculine vs. feminine), "When is his birthday", to see whether she handles reference using a possessive pronoun, or "When did that president die" to see whether she handles definite reference.


Question 3. Recall that Bayes's Rule is often used in "Bayesian updating", since it is used to take a prior probability distribution and update it on the basis of observed evidence to produce a posterior distribution. Before, after, hence updating; get it?

This notion of "Bayesian updating" is particularly useful when applied iteratively. Consider a scenario where we have a prior distribution P(H) over hypotheses, and then we observe evidence E1 and use Bayes's Rule to update our distribution to

               P(E1 | H) P(H)
  P(H | E1) =  --------------
                 P(E1)
The distribution P(H|E1) can now be viewed as a new, more informed prior. Therefore if we see a new piece of evidence E2, we can use Bayes's Rule again to derive a new posterior. Since P(H|E1) is the prior now, the result will take the form
                  X  P(H | E1)
  P(H | E1,E2) =  ------------
                       Y

Derive the simplest possible form of the full expression, i.e. fill in X and Y, assuming that E1 and E2 are independent. (Note that if you don't make that assumption, you won't get the right answer.)


Question 4. First, if necessary, review Manning & Schuetze Section 2.1, on foundational concepts in probability theory.

Then, go to Wolfram Alpha and try typing the following things into the box at the top (and then hit Enter or click the "=" sign).

Fun, huh? Ok, now try it with the Beta distribution:

4(a) Look at the PDFs (probability density functions) for each one, and explain in plain English what each of these Beta distributions represents, when interpreted as a Bayesian prior for the probability of heads. (To keep things standard, let's all assume that the prior belief is about the probability of heads for a possibly-unfair coin.) What is your expectation about what the probability of heads will be, and how strongly do you think so?

4(b) Let's take the notion of "expectation" in (4a) a little more literally, as in expected value, also known as the mean of the distribution. Try typing BetaDistribution[α,β] for some other values of α and β, and look at the number Wolfram Alpha reports as the "mean". Can you figure out what the formula for the mean is, as a function of α and β? (If you can't give an exact formula, at least comment on some properties of the mean. If you already knew the formula, it's ok to tell me so. But don't just look up the mean of the Beta distribution and copy it down; what would you learn from that?!)


Question 5. Create a "quick and dirty" program that takes the text of this homework assignment (that is this Web page) and produces as output the 20 most frequent bigrams, excluding any bigrams containing stopwords. Briefly explain how you did this, including any choices you made in the interest of keeping things "quick and dirty" (e.g. with respect to tokenization, normalization, etc.) that you would improve if you were doing this for real. Note that the goal here is not to impress me with how well you can write a program to extract bigrams; see the definition of quick and dirty if you weren't already familiar with that expression. Using existing code is ok; if you can find software somewhere with a function called
extract-nonstoplist-bigrams-from-a-web-page-and-sort-by-frequency
by all means go ahead and use it. Ok, that probably doesn't exist, but if you want to use an existing toolkit, that's fine. (If you code in python, two good existing packages are NLTK or spaCy. If you are choosing between those two, NLTK has the advantage of being very tutorial, including having an associated textbook, but spaCy is is what you'd want if you were writing "production" software.) Like the other questions on this assignment, this is a reality check: if you find it very challenging or time consuming, then we should probably talk about whether this course is right for you.


Question 6. Read this blog posting about "Data Science on State of the Union Addresses: Obama (2016) vs. Obama (2015) vs. ... vs. George Washington (1790)". Are there any technical terms or ideas here that you don't understand, and if so, what's your best guess as to what they mean? What do you think of the analysis -- do you find it convincing? What ideas would you suggest for improving it?


Question 7. Do the reading for next class. Ok, that's not exactly a question, it's more of a reminder. But many people need the reminder. :)