├── LICENSE
├── README.md
├── _config.yml
├── images
├── .DS_Store
├── LanguageExample.jpg
├── MonteCarloTreeSearch.jpg
├── NumericalLinearAlgebra.jpg
├── RayTracing.jpg
├── StableDiffusion.jpg
├── StochasticDescent.jpg
└── WalkOnSpheres.jpg
└── index.html
/LICENSE:
--------------------------------------------------------------------------------
1 | Creative Commons Legal Code
2 |
3 | CC0 1.0 Universal
4 |
5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12 | HEREUNDER.
13 |
14 | Statement of Purpose
15 |
16 | The laws of most jurisdictions throughout the world automatically confer
17 | exclusive Copyright and Related Rights (defined below) upon the creator
18 | and subsequent owner(s) (each and all, an "owner") of an original work of
19 | authorship and/or a database (each, a "Work").
20 |
21 | Certain owners wish to permanently relinquish those rights to a Work for
22 | the purpose of contributing to a commons of creative, cultural and
23 | scientific works ("Commons") that the public can reliably and without fear
24 | of later claims of infringement build upon, modify, incorporate in other
25 | works, reuse and redistribute as freely as possible in any form whatsoever
26 | and for any purposes, including without limitation commercial purposes.
27 | These owners may contribute to the Commons to promote the ideal of a free
28 | culture and the further production of creative, cultural and scientific
29 | works, or to gain reputation or greater distribution for their Work in
30 | part through the use and efforts of others.
31 |
32 | For these and/or other purposes and motivations, and without any
33 | expectation of additional consideration or compensation, the person
34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35 | is an owner of Copyright and Related Rights in the Work, voluntarily
36 | elects to apply CC0 to the Work and publicly distribute the Work under its
37 | terms, with knowledge of his or her Copyright and Related Rights in the
38 | Work and the meaning and intended legal effect of CC0 on those rights.
39 |
40 | 1. Copyright and Related Rights. A Work made available under CC0 may be
41 | protected by copyright and related or neighboring rights ("Copyright and
42 | Related Rights"). Copyright and Related Rights include, but are not
43 | limited to, the following:
44 |
45 | i. the right to reproduce, adapt, distribute, perform, display,
46 | communicate, and translate a Work;
47 | ii. moral rights retained by the original author(s) and/or performer(s);
48 | iii. publicity and privacy rights pertaining to a person's image or
49 | likeness depicted in a Work;
50 | iv. rights protecting against unfair competition in regards to a Work,
51 | subject to the limitations in paragraph 4(a), below;
52 | v. rights protecting the extraction, dissemination, use and reuse of data
53 | in a Work;
54 | vi. database rights (such as those arising under Directive 96/9/EC of the
55 | European Parliament and of the Council of 11 March 1996 on the legal
56 | protection of databases, and under any national implementation
57 | thereof, including any amended or successor version of such
58 | directive); and
59 | vii. other similar, equivalent or corresponding rights throughout the
60 | world based on applicable law or treaty, and any national
61 | implementations thereof.
62 |
63 | 2. Waiver. To the greatest extent permitted by, but not in contravention
64 | of, applicable law, Affirmer hereby overtly, fully, permanently,
65 | irrevocably and unconditionally waives, abandons, and surrenders all of
66 | Affirmer's Copyright and Related Rights and associated claims and causes
67 | of action, whether now known or unknown (including existing as well as
68 | future claims and causes of action), in the Work (i) in all territories
69 | worldwide, (ii) for the maximum duration provided by applicable law or
70 | treaty (including future time extensions), (iii) in any current or future
71 | medium and for any number of copies, and (iv) for any purpose whatsoever,
72 | including without limitation commercial, advertising or promotional
73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74 | member of the public at large and to the detriment of Affirmer's heirs and
75 | successors, fully intending that such Waiver shall not be subject to
76 | revocation, rescission, cancellation, termination, or any other legal or
77 | equitable action to disrupt the quiet enjoyment of the Work by the public
78 | as contemplated by Affirmer's express Statement of Purpose.
79 |
80 | 3. Public License Fallback. Should any part of the Waiver for any reason
81 | be judged legally invalid or ineffective under applicable law, then the
82 | Waiver shall be preserved to the maximum extent permitted taking into
83 | account Affirmer's express Statement of Purpose. In addition, to the
84 | extent the Waiver is so judged Affirmer hereby grants to each affected
85 | person a royalty-free, non transferable, non sublicensable, non exclusive,
86 | irrevocable and unconditional license to exercise Affirmer's Copyright and
87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the
88 | maximum duration provided by applicable law or treaty (including future
89 | time extensions), (iii) in any current or future medium and for any number
90 | of copies, and (iv) for any purpose whatsoever, including without
91 | limitation commercial, advertising or promotional purposes (the
92 | "License"). The License shall be deemed effective as of the date CC0 was
93 | applied by Affirmer to the Work. Should any part of the License for any
94 | reason be judged legally invalid or ineffective under applicable law, such
95 | partial invalidity or ineffectiveness shall not invalidate the remainder
96 | of the License, and in such case Affirmer hereby affirms that he or she
97 | will not (i) exercise any of his or her remaining Copyright and Related
98 | Rights in the Work or (ii) assert any associated claims and causes of
99 | action with respect to the Work, in either case contrary to Affirmer's
100 | express Statement of Purpose.
101 |
102 | 4. Limitations and Disclaimers.
103 |
104 | a. No trademark or patent rights held by Affirmer are waived, abandoned,
105 | surrendered, licensed or otherwise affected by this document.
106 | b. Affirmer offers the Work as-is and makes no representations or
107 | warranties of any kind concerning the Work, express, implied,
108 | statutory or otherwise, including without limitation warranties of
109 | title, merchantability, fitness for a particular purpose, non
110 | infringement, or the absence of latent or other defects, accuracy, or
111 | the present or absence of errors, whether or not discoverable, all to
112 | the greatest extent permissible under applicable law.
113 | c. Affirmer disclaims responsibility for clearing rights of other persons
114 | that may apply to the Work or any use thereof, including without
115 | limitation any person's Copyright and Related Rights in the Work.
116 | Further, Affirmer disclaims responsibility for obtaining any necessary
117 | consents, permissions or other rights required for any use of the
118 | Work.
119 | d. Affirmer understands and acknowledges that Creative Commons is not a
120 | party to this document and has no duty or obligation with respect to
121 | this CC0 or use of the Work.
122 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # montecarlo-course
2 |
3 | Course material for CMU course on _Monte Carlo Methods and Applications_.
4 |
--------------------------------------------------------------------------------
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-minimal
2 |
--------------------------------------------------------------------------------
/images/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/.DS_Store
--------------------------------------------------------------------------------
/images/LanguageExample.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/LanguageExample.jpg
--------------------------------------------------------------------------------
/images/MonteCarloTreeSearch.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/MonteCarloTreeSearch.jpg
--------------------------------------------------------------------------------
/images/NumericalLinearAlgebra.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/NumericalLinearAlgebra.jpg
--------------------------------------------------------------------------------
/images/RayTracing.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/RayTracing.jpg
--------------------------------------------------------------------------------
/images/StableDiffusion.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/StableDiffusion.jpg
--------------------------------------------------------------------------------
/images/StochasticDescent.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/StochasticDescent.jpg
--------------------------------------------------------------------------------
/images/WalkOnSpheres.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GeometryCollective/montecarlo-course/5acddd020d8e98dd906bbf4b7721c77c1ce0a90a/images/WalkOnSpheres.jpg
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Monte Carlo Methods and Applications
5 |
6 |
7 |
8 |
9 |
10 | # Monte Carlo Methods and Applications
11 | ## 21-387 | 15-327 | 15-627 | 15-860 FALL 2023
12 |
13 | **Instructors:** Keenan Crane (CSD/RI) and Gautam Iyer (MSC)
14 |
15 | **Units:** **9** (3 in-class/6 outside)
16 |
17 | ### Course Description
18 |
19 | The Monte Carlo method uses random sampling to solve computational problems that would otherwise be intractable, and enables computers to model complex systems in nature that are otherwise too difficult to simulate. This course provides a first introduction to Monte Carlo methods from complementary theoretical and applied points of view, and will include implementation of practical algorithms. Topics include random number generation, sampling, Markov chains, Monte Carlo integration, stochastic processes, and applications in computational science. Students need a basic background in probability, multivariable calculus, and some coding experience in any language.
20 |
21 | ### Course Relevance
22 |
23 | _How is this course relevant to the targeted student populations?_
24 |
25 | Random numbers are a basic tool for achieving robustness, scalability, and correctness in the design of algorithms. Moreover, randomness is an essential part of models used to describe the behavior of systems found throughout science, technology, and engineering. The Monte Carlo method in particular was recognized by SIAM as one of the [most important 10 algorithms of the 20th century](http://pi.math.cornell.edu/~web6140/). Yet foundational and practical aspects of such methods are not currently covered in depth by any course at CMU. This course complements the existing curriculum, helping to better prepare students to apply randomness to problem solving in both academic and industrial settings.
26 |
27 | ### Key Topics
28 |
29 | _What are the key subject topics that this course will cover?_
30 |
31 | definitions of randomness, random number generation, randomness testing and quality measures, curse of dimensionality, sampling and aliasing, Markov chains, Monte Carlo methods, stochastic processes, sample generation algorithms, applications of random numbers in computation
32 |
33 |
34 | ### Course Goals
35 |
36 | _What are the overall goals of this course that students will achieve after completing it?_
37 |
38 | The goal of this course is to enable students to identify situations where random sampling provides the best solution to a computational/algorithmic problem, and to train them in the practical implementation of associated methods. Students should also acquire the mathematical background needed to derive new algorithms from first principles, rather than purely applying existing techniques, and to analyze the correctness and efficiency of these algorithms. (For example, they should be able to determine whether a given Monte Carlo estimator is unbiased, and measure the empirical efficiency of such algorithms in terms of statistics such as variance.)
39 |
40 | A secondary goal of this course is to expose students to a collection of application areas in computer science and the broader sciences where randomness can be profitably applied. In computer science, this set includes problems in computer systems/networking, programming languages, theoretical computer science, artificial intelligence/machine learning, and computer graphics. In the broader sciences, this includes partial differential equations arising in physics/chemistry/biology/etc., and stochastic models appearing in mathematical finance.
41 |
42 | ### Prerequisite Knowledge
43 |
44 | _What prior knowledge must students have in order to be successful in this course?_
45 |
46 | Students must have basic knowledge of coding (in any language), as well as basic knowledge of probability and multivariable calculus. CMU courses satisfy the prerequisites are listed below; please contact the instructors if you believe you've taken a different course that fulfills the requirement.
47 |
48 | **Probability:** 15-259 or 15-659 or 21-325 or 21-721 or 36-218 or 36-219 or 36-225 or 36-235 or 36-700 or 45-750 or 18-465 or 18-665
49 |
50 | **Multivariable Calculus:** 21-254 or 21-256 or 21-259 or 21-266 or 21-268 or 21-269
51 |
52 |
127 |
128 |
136 |
137 | ### Accommodations for Students with Disabilities
138 |
139 | If you have a disability and have an accommodations letter from the
140 | Disability Resources office, I encourage you to discuss your
141 | accommodations and needs with me as early in the semester as
142 | possible. I will work with you to ensure that accommodations are
143 | provided as appropriate. If you suspect that you may have a
144 | disability and would benefit from accommodations but are not yet
145 | registered with the Office of Disability Resources, I encourage you
146 | to contact them at [access@andrew.cmu.edu](mailto:access@andrew.cmu.edu).
147 |
148 | ### Student Wellness
149 |
150 | As a student, you may experience a range of challenges that can
151 | interfere with learning, such as strained relationships, increased
152 | anxiety, substance use, feeling down, difficulty concentrating
153 | and/or lack of motivation. These mental health concerns or stressful
154 | events may diminish your academic performance and/or reduce your
155 | ability to participate in daily activities. CMU services are
156 | available, and treatment does work. You can learn more about
157 | confidential mental health services available on campus
158 | [here](http://www.cmu.edu/counseling). Support is always available
159 | (24/7) from Counseling and Psychological Services: 412-268-2922.
160 |
161 | ### Final Project
162 |
163 | Students are free to choose their own topic for the final project, but we will provide a variety of suggested topics to get them started. The basic task is to identify and implement an algorithm in the chosen topic area; students will also need to turn in a detailed writeup (more detail below). Note that two of these topics are covered in class (ray tracing and walk on spheres); we expect students who choose these topics to go deeper than the basic algorithms presented in lecture.
164 |
165 | #### Topic suggestion: Monte Carlo Ray Tracing
166 |
167 | 
168 |
169 | _Ray tracing_ is the basic algorithm used to synthesize photorealistic images from digital descriptions of a 3D scene. This kind of image synthesis powers a rich variety of applications ranging from architectural pre-visualization, to 3D reconstruction from photographs, to computer-generated imagery for movies. The starting point for ray tracing is a recursive integral equation, called the _rendering equation_. Even in simple scenarios, these integrals are impossible to evaluate directly, and must be approximated via recursive application of Monte Carlo integration. As with all Monte Carlo methods, the main challenge is to improve efficiency by getting more accurate approximation of the integrals using fewer, cheaper samples. For this project you could implement any number of variance reduction/acceleration strategies from the Monte Carlo and MCMC literature. Note that your project should _not_ center on other aspects of rendering (e.g., more sophisticated material models), but must focus on ways of making randomized computation more efficient.
170 |
171 | #### Topic suggestion: Walk on Spheres
172 |
173 | 
174 |
175 | The _walk on spheres (WoS)_ algorithm is a method for solving partial differential equations (PDEs), especially well-suited to problems with complex geometry and/or challenging material coefficients. PDEs are used to model phenomena throughout science engineering, say, thermal analysis of a heat sink or combustion engine, oxygen diffusion in the lungs, or fluid flow around an airplane. WoS side-steps many of the challenges of traditional PDE solvers (such as finite element mesh generation), and has a flavor very similar to Monte Carlo ray tracing: estimate the solution to an integral equation via recursive application of the Monte Carlo method. For this project you could implement more sophisticated WoS methods from the literature, add variance reduction techniques for WoS, or you could try to develop new estimators for different classes of PDEs (say, the Helmholtz equation or Robin boundary conditions).
176 |
177 | #### Topic suggestion: Stochastic Optimization
178 |
179 | 
180 |
181 | Numerical optimization methods like _stochastic gradient descent (SGD)_ are a central part of modern methods for machine learning. Since these problems typically involve massive data sets, and models with an enormous number of parameters, random sampling is needed to make computation feasible. In contrast to ordinary gradient descent, which minimizes an objective by following the direction of steepest descent, SGD approximates the gradient direction using random sampling. The quality of this approximation in turn affects the rate of convergence—and ultimately, the performance of the model. For this project you should implement at least two stochastic optimization techniques (e.g., SGD and ADAM) and/or acceleration/variance reduction techniques for these methods, and compare their performance on a training task. Alternatively, you could compare the performance of deterministic and stochastic methods (e.g., SGD and L-BFGS) on a smaller-scale optimization problem (which may be easier to run on a personal computer!), and try to improve the performance of the stochastic algorithm to better compete with the deterministic method.
182 |
183 | #### Topic suggestion: Stable Diffusion
184 |
185 | 
186 |
187 | In recent years, _stable diffusion_ models have been used to build impressive image synthesis systems, such as [DALL-E 2](https://openai.com/dall-e-2/), which generates a plausible image from a short text description. At the core of stable diffusion models are _reverse_ SDEs: in a nutshell, a given data set (say, photographs of cats) are corrupted by random diffusion, and a neural network is trained to reverse this diffusion process---making it possible to ``un-corrupt'' any random signal into a nearby plausible image. Given the cost and complexity of implementing and running such models, it is probably sufficient for this project to implement a simple stable diffusion model, and run it on an existing data set. You could also try, for instance, to implement stable diffusion on a different domain (say, meshes instead of images), or think about how variance reduction strategies can be applied to improve the performance of existing stable diffusion models.
188 |
189 | #### Topic suggestion: Monte Carlo Tree Search
190 |
191 | 
192 |
193 | In recent years, systems such as [Alpha Go Zero](https://www.deepmind.com/blog/alphago-zero-starting-from-scratch) have made major leaps in the ability of computers to play games—and defeat human experts. Although much of the press hype surrounding such systems has focused on neural networks, the [real workhorse](https://joshvarty.github.io/AlphaZero/) in many of these methods is _Monte Carlo tree search (MCTS)_. The basic observation is that, although there are typically an enormous number of possible games that can be played (e.g., about [10120](https://en.wikipedia.org/wiki/Shannon_number) in a game of chess!), randomly sampling a _much_ smaller number of games and evaluating the final score can provide remarkably good information for developing a strategy. For this project you should implement MCTS for a game _other than Chess or Go_ (say, [checkers](https://en.wikipedia.org/wiki/Checkers), [gomoku](https://en.wikipedia.org/wiki/Gomoku), or [connect four](https://en.wikipedia.org/wiki/Connect_Four)). You should also implement at least one basic variance reduction strategy, and compare the performance of your search with/without this strategy (e.g., by playing your AI against itself).
194 |
195 | #### Topic suggestion: Numerical Linear Algebra
196 |
197 | 
198 |
199 | An enormous number of tasks in computational science reduce to solving matrix equations encoding large linear systems (e.g., electronic structure calculations, finite element solvers, analysis of large social networks, etc.). As the size of these matrices grows, solving these systems deterministically becomes extremely challenging—for instance, many of the world's largest supercomputers are devoted to solving such systems. However, for many types of linear systems a solution can still be reliably estimated via random sampling. For this project you should implement a randomized method for one type of matrix problem (e.g., solving a linear system, solving an eigenvalue problem, or applying the exponential map), and compare your stochastic solver with a deterministic solver in terms of accuracy and performance with respect to problem size. You should also think about how to improve your estimates using, e.g., variance reduction and acceleration strategies discussed in class.
200 |
201 | #### Topic suggestion: Natural Language Models
202 |
203 | 
204 |
205 | Natural language is a powerful tool for human-computer interaction; synthesizing and interpreting natural language is the basis for a variety of technologies ranging from simple autocomplete/next-word prediction to home assistants like Amazon Alexa and Apple's Siri. In recent years especially, large language models like GPT-3 have provided impressive examples of large-scale text synthesis. For this project you should start at the beginning, and implement a simpler language model, e.g., next-word prediction using a basic Markov chain model (since such models can be efficiently trained on a personal computer). You should also explore techniques for improving your language model over the basic version, e.g., comparing a 1st-order and 2nd-order Markov chain model. Finally, it would be fun to compare the performance of your simple model to state-of-the-art models like ChatGPT (e.g., by having both models complete a set of sentences).
206 |
207 | ### Assessment Structure
208 |
209 | _How will students be assessed in this course: assignments, exams, final, presentation, project, etc.? (Weighted values are extremely helpful, i.e. homeworks 15%, quizzes 15%, mid-term exam 30%, final exam 40%)_
210 |
211 | The assessment breakdown is as follows:
212 |
213 | - (37%) written exercises
214 | - (37%) coding assignments
215 | - (20%) final project
216 | - (6%) class participation
217 |
218 | There will be four (4) assignments over the first half of the semester, which help establish an understanding of basic principles and how they are applied computationally. A final project during the second half of the semester enables students to go deeper in one particular application area of interest---we will suggest a variety of projects, but students are free to design their own. Each assignment is comprised of complementary written and coding components. Written exercises guide students through derivation of basic knowledge needed to develop and implement algorithms in the coding part. To help make the course accessible to non-CS majors, coding exercises will be carried out in Python, via web-based Jupyter notebooks. For the final project, students will implement an existing algorithm in their chosen topic area; more ambitious students are encouraged to think about how to improve on existing algorithms. In addition to an implementation, the final report for each project must include a writeup that motivates the problem, describes the algorithmic solution and any relevant implementation details, provides plots/data that verify correctness of the implementation, and visualizes results of running the algorithm. The course also encourages student-instructor and student-student engagement with material through in-class discussions, as well as discussions through Piazza and a private class Discord; activity in these settings will be used to evaluate the class participation grade.
219 |
220 |
221 | ### Learning Resources
222 |
223 | _What resources will be available for students: web pages, learning applications, texts, case studies, etc.?_
224 |
225 | The primary resource for the course are a collection of course notes written by the instructors. Students will also be given ancillary references to classic texts (e.g., Øksendal and Pharr et al).
226 |
227 |
228 | ### Extra Time Commitments
229 |
230 | _Are there extra time commitments required outside of the regularly scheduled course meeting times? Estimated hours per (day) (week)_
231 |
232 | The main extra time commitments are written/coding exercises, and studying for midterm/final exams. The estimated number of out-of-class hours is four hours/week.
233 |
234 |
235 | ### Course Tags
236 |
237 | _Keywords referencing general topics and/or course structure:_
238 |
239 | - Communication
240 | - Discussion Intensive
241 | - Diversity
242 | - Entrepreneurship
243 | - Ethics
244 | - Global
245 | - IDeATe
246 | - Independent Study
247 | - **Interdisciplinary**
248 | - Lab Component
249 | - Maker
250 | - Reading Intensive
251 | - **Research**
252 | - Service Learning
253 | - Sustainability/Environment
254 | - Team Project
255 | - Writing Intensive
256 | - **for Non-Majors**
257 |
258 |