Week 06 - October 21¶
Class Description¶
This week we explore probability and randomness through simulation and computation. You'll see how probability theory provides predictions that can be verified through repeated trials, and how object-oriented programming makes complex simulations elegant and maintainable.
Key Connection: Probability theory makes mathematical predictions → Simulations test those predictions through code → Testing validates implementations → Data persistence enables reproducibility.
Key Learning Objectives: - Apply probability theory through Monte Carlo simulation - Build classes that represent probability distributions and random experiments - Use JSON for data persistence - Write comprehensive tests for object-oriented code using pytest - Compare theoretical probabilities to empirical results
Before Class¶
Videos to Watch Before Class¶
CS 5002 - Module 6: Probability¶
- Lesson 1: Overview of Probability
- Lesson 2: Probability Events
- Lesson 3: Conditional Probability
- Lesson 4: Law of Total Probability
- Lesson 5: Bayes' Theorem
- Lesson 6: Random Variables and Expected Values
Alternative CS 5002 videos:
- Module 6: Lesson 1: Overview of Probability
- Module 6: Lesson 2: Events, Experiments, Sample Space and Probabilities
- Module 6: Lesson 3: Independence and Conditional Probability
- Module 6: Lesson 4: Bayes' Rule
- Module 6: Lesson 5: Mathematical Expectation
- Module 6: Lesson 6: Variance
CS 5001 - Object-Oriented Programming (Continued)¶
- Lesson 8.5: Printing Objects [7:44]
- Lesson 8.6: Testing Classes [13:14]
CS 5001 - File I/O and Data Persistence¶
- Lesson 7.6: Files as an Example [13:18]
- Lesson 7.7: Collecting Data [14:45]
Additional Resources (External)¶
- How To Use JSON In Python [6:10] - Using
json.dump()andjson.load(), serializing data structures - Getting Started with pytest [13:15] - Testing object-oriented code with pytest