October 4, 2019
For today
Work on your project (fail fast)
Prepare for a quiz on Chapters 5 and 6 (here's last year's quiz for practice)
Today
Quiz
Chapter 6
Notebook 4
Project
For next time:
Read Chapter 7 and do the reading quiz
News from the world of Cellular Automata: Announcing the Rule 30 Prizes
Notebook 4 notes
1) Many of the notebook exercises ask you to do something and then interpret the results. Please write a sentence to two to show that you understand the meaning of the results.
2) For the HK network, chances are you were not able to get the clustering coefficient to be as high as what we see in the data. What conclusion do you draw?
3) For both the actor network and the HK model, many of you plotted the CDF on a log-log scale.
And some of you looked at that plot and wrote "Yup, looks like a power law". Really? How did you get that?
Here's what the CCDF looks like on a log-log scale:
The following are six possibly-correct solutions to the pangram question:
A pangram is a word or phrase that uses every letter in the alphabet, like ``The quick brown fox jumps over the lazy dog.'' Write a boolean function called is_pangram that takes a string containing upper and lower case letters and tests whether it is a pangram.
For each solution, check whether it is correct, and figure out its order of growth (even though for short phrases, order of growth is not particularly useful).
For the set operations, you might find this page helpful.
import string
def uses_all(word, letters):
for c in letters:
if c not in word:
return False
return True
def is_pangram1(phrase):
return uses_all(phrase.lower(), string.ascii_lowercase)
def is_pangram2(phrase):
letterset = set(phrase.lower())
letterset = letterset.difference(string.whitespace +
string.punctuation)
return len(letterset) == 26
def is_pangram3(phrase):
letterset = set(phrase.lower())
letterset -= set(string.whitespace + string.punctuation)
return len(letterset) == 26
def is_pangram4(phrase):
return set(string.ascii_lowercase).issubset(phrase.lower())
def is_pangram5(phrase):
letters = phrase.lower().replace(' ', '')
return len(set(letters)) == 26
def is_pangram6(phrase):
phrase = phrase.lower()
for c in string.ascii_lowercase:
if c not in phrase:
return False
return True
Project schedule
Oct 8: turn in a notebook that can run on Binder
Oct 11: draft report
Oct 15: draft feedback
Oct 22: final report
If you have a notebook in a public repo on GitHub, you should be able to run it on Binder.
The one catch is that you need to tell Binder what packages are required.
There are several ways to do that; the one I recommend is to include an environment.yml file in the top level of the repo.
If you copy the one from ThinkComplexity2, that will probably do it.