├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── _config.yml ├── _data ├── options.yml └── social.yml ├── _includes ├── footer.html ├── head.html ├── header.html └── print-footer.html ├── _layouts ├── default.html ├── full-width.html ├── page.html └── post.html ├── _plugins ├── fullwidth.rb ├── main_column_img.rb ├── margin_figure.rb ├── marginnote.rb ├── mathjaxtag.rb ├── newthought.rb └── sidenote.rb ├── _sass ├── _fonts.scss ├── _settings.scss └── _syntax-highlighting.scss ├── autoregressive ├── autoregressive.png ├── fvsbn.png ├── index.md ├── index.tex └── nade.png ├── css ├── tufte.css ├── tufte.orginal.css └── tufte.scss ├── docs ├── LICENSE ├── Makefile ├── autoregressive │ ├── autoregressive.png │ ├── fvsbn.png │ ├── index.html │ ├── index.tex │ └── nade.png ├── css │ ├── tufte.css │ └── tufte.orginal.css ├── flow │ ├── flow-graphical.PNG │ ├── iaf.PNG │ ├── index.html │ └── maf.PNG ├── fonts │ ├── et-bembo │ │ ├── et-bembo-bold-line-figures │ │ │ ├── et-bembo-bold-line-figures.eot │ │ │ ├── et-bembo-bold-line-figures.svg │ │ │ ├── et-bembo-bold-line-figures.ttf │ │ │ └── et-bembo-bold-line-figures.woff │ │ ├── et-bembo-display-italic-old-style-figures │ │ │ ├── et-bembo-display-italic-old-style-figures.eot │ │ │ ├── et-bembo-display-italic-old-style-figures.svg │ │ │ ├── et-bembo-display-italic-old-style-figures.ttf │ │ │ └── et-bembo-display-italic-old-style-figures.woff │ │ ├── et-bembo-roman-line-figures │ │ │ ├── et-bembo-roman-line-figures.eot │ │ │ ├── et-bembo-roman-line-figures.svg │ │ │ ├── et-bembo-roman-line-figures.ttf │ │ │ └── et-bembo-roman-line-figures.woff │ │ ├── et-bembo-roman-old-style-figures │ │ │ ├── et-bembo-roman-old-style-figures.eot │ │ │ ├── et-bembo-roman-old-style-figures.svg │ │ │ ├── et-bembo-roman-old-style-figures.ttf │ │ │ └── et-bembo-roman-old-style-figures.woff │ │ └── et-bembo-semi-bold-old-style-figures │ │ │ ├── et-bembo-semi-bold-old-style-figures.eot │ │ │ ├── et-bembo-semi-bold-old-style-figures.svg │ │ │ ├── et-bembo-semi-bold-old-style-figures.ttf │ │ │ └── et-bembo-semi-bold-old-style-figures.woff │ ├── et-book │ │ ├── et-book-bold-line-figures │ │ │ ├── et-book-bold-line-figures.eot │ │ │ ├── et-book-bold-line-figures.svg │ │ │ ├── et-book-bold-line-figures.ttf │ │ │ └── et-book-bold-line-figures.woff │ │ ├── et-book-display-italic-old-style-figures │ │ │ ├── et-book-display-italic-old-style-figures.eot │ │ │ ├── et-book-display-italic-old-style-figures.svg │ │ │ ├── et-book-display-italic-old-style-figures.ttf │ │ │ └── et-book-display-italic-old-style-figures.woff │ │ ├── et-book-roman-line-figures │ │ │ ├── et-book-roman-line-figures.eot │ │ │ ├── et-book-roman-line-figures.svg │ │ │ ├── et-book-roman-line-figures.ttf │ │ │ └── et-book-roman-line-figures.woff │ │ ├── et-book-roman-old-style-figures │ │ │ ├── et-book-roman-old-style-figures.eot │ │ │ ├── et-book-roman-old-style-figures.svg │ │ │ ├── et-book-roman-old-style-figures.ttf │ │ │ └── et-book-roman-old-style-figures.woff │ │ └── et-book-semi-bold-old-style-figures │ │ │ ├── et-book-semi-bold-old-style-figures.eot │ │ │ ├── et-book-semi-bold-old-style-figures.svg │ │ │ ├── et-book-semi-bold-old-style-figures.ttf │ │ │ └── et-book-semi-bold-old-style-figures.woff │ ├── icomoon.eot │ ├── icomoon.svg │ ├── icomoon.ttf │ └── icomoon.woff ├── gan │ ├── cyclegan_gendisc.png │ ├── gan.png │ ├── index.html │ └── index.tex ├── index.html ├── introduction │ ├── index.html │ ├── learning.png │ ├── learning_1.png │ └── learning_2.png └── vae │ ├── index.html │ ├── klgap.png │ └── vae.png ├── flow ├── flow-graphical.PNG ├── flow-graphical.png ├── iaf.PNG ├── iaf.png ├── index.md ├── maf.PNG └── maf.png ├── fonts ├── et-bembo │ ├── et-bembo-bold-line-figures │ │ ├── et-bembo-bold-line-figures.eot │ │ ├── et-bembo-bold-line-figures.svg │ │ ├── et-bembo-bold-line-figures.ttf │ │ └── et-bembo-bold-line-figures.woff │ ├── et-bembo-display-italic-old-style-figures │ │ ├── et-bembo-display-italic-old-style-figures.eot │ │ ├── et-bembo-display-italic-old-style-figures.svg │ │ ├── et-bembo-display-italic-old-style-figures.ttf │ │ └── et-bembo-display-italic-old-style-figures.woff │ ├── et-bembo-roman-line-figures │ │ ├── et-bembo-roman-line-figures.eot │ │ ├── et-bembo-roman-line-figures.svg │ │ ├── et-bembo-roman-line-figures.ttf │ │ └── et-bembo-roman-line-figures.woff │ ├── et-bembo-roman-old-style-figures │ │ ├── et-bembo-roman-old-style-figures.eot │ │ ├── et-bembo-roman-old-style-figures.svg │ │ ├── et-bembo-roman-old-style-figures.ttf │ │ └── et-bembo-roman-old-style-figures.woff │ └── et-bembo-semi-bold-old-style-figures │ │ ├── et-bembo-semi-bold-old-style-figures.eot │ │ ├── et-bembo-semi-bold-old-style-figures.svg │ │ ├── et-bembo-semi-bold-old-style-figures.ttf │ │ └── et-bembo-semi-bold-old-style-figures.woff ├── et-book │ ├── et-book-bold-line-figures │ │ ├── et-book-bold-line-figures.eot │ │ ├── et-book-bold-line-figures.svg │ │ ├── et-book-bold-line-figures.ttf │ │ └── et-book-bold-line-figures.woff │ ├── et-book-display-italic-old-style-figures │ │ ├── et-book-display-italic-old-style-figures.eot │ │ ├── et-book-display-italic-old-style-figures.svg │ │ ├── et-book-display-italic-old-style-figures.ttf │ │ └── et-book-display-italic-old-style-figures.woff │ ├── et-book-roman-line-figures │ │ ├── et-book-roman-line-figures.eot │ │ ├── et-book-roman-line-figures.svg │ │ ├── et-book-roman-line-figures.ttf │ │ └── et-book-roman-line-figures.woff │ ├── et-book-roman-old-style-figures │ │ ├── et-book-roman-old-style-figures.eot │ │ ├── et-book-roman-old-style-figures.svg │ │ ├── et-book-roman-old-style-figures.ttf │ │ └── et-book-roman-old-style-figures.woff │ └── et-book-semi-bold-old-style-figures │ │ ├── et-book-semi-bold-old-style-figures.eot │ │ ├── et-book-semi-bold-old-style-figures.svg │ │ ├── et-book-semi-bold-old-style-figures.ttf │ │ └── et-book-semi-bold-old-style-figures.woff ├── icomoon.eot ├── icomoon.svg ├── icomoon.ttf └── icomoon.woff ├── gan ├── cyclegan_gendisc.png ├── gan.png ├── index.md └── index.tex ├── index.md ├── introduction ├── index.md ├── learning.png ├── learning_1.png └── learning_2.png └── vae ├── index.md ├── klgap.png └── vae.png /.gitignore: -------------------------------------------------------------------------------- 1 | _site 2 | .sass-cache 3 | .DS\_Store 4 | config.codekit 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2018 Aditya Grover, Stefano Ermon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | TEMPDIR := $(shell mktemp -d -t tmp.XXX) 2 | 3 | publish: 4 | echo 'hmmm' 5 | cp -r ./_site/* $(TEMPDIR) 6 | cd $(TEMPDIR) && \ 7 | ls -a && \ 8 | git init && \ 9 | git add . && \ 10 | git commit -m 'publish site' && \ 11 | git remote add origin https://github.com/deepgenerativemodels/notes.git && \ 12 | git push origin master:refs/heads/gh-pages --force 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Notes on Deep Generative Models 2 | 3 | These notes form a concise introductory course on deep generative models. They are based on Stanford [CS236](https://deepgenerativemodels.github.io/), taught by [Aditya Grover](http://aditya-grover.github.io/) and [Stefano Ermon](http://cs.stanford.edu/~ermon/), and have been written by [Aditya Grover](http://aditya-grover.github.io/), with the [help](https://github.com/deepgenerativemodels/notes/commits/master) of many students and course staff. 4 | 5 | The compiled version is available [here](https://deepgenerativemodels.github.io/notes/index.html). 6 | 7 | ## Contributing 8 | 9 | This material is under construction! Although we have written up most of it, you will probably find several typos. If you do, please let us know, or submit a pull request with your fixes via Github. 10 | 11 | 12 | The notes are written in Markdown and are compiled into HTML using Jekyll. Please add your changes directly to the Markdown source code. In order to install jekyll, you can follow the instructions posted on their website (https://jekyllrb.com/docs/installation/). 13 | 14 | Note that jekyll is only supported on GNU/Linux, Unix, or macOS. Thus, if you run Windows 10 on your local machine, you will have to install Bash on Ubuntu on Windows. Windows gives instructions on how to do that here and Jekyll's website offers helpful instructions on how to proceed through the rest of the process. 15 | 16 | To compile Markdown to HTML (i.e. after you have made changes to markdown and want them to be accessible to students viewing the docs), 17 | run the following commands from the root of your cloned version of the https://github.com/deepgenerativemodels/notes repo: 18 | 1) rm -r docs/ 19 | 2) jekyll serve # This should create a folder called _site. Note: This creates a running server; press Ctrl-C to stop the server before proceeding 20 | 3) mv _site docs # Change the name of the _site folder to "docs". This won't work if the server is still running. 21 | 4) git add file_names 22 | 5) git commit -am "your commit message describing what you did" 23 | 6) git push origin master 24 | 25 | Note that if you cloned the ermongroup/cs228-notes repo directly onto your local machine (instead of forking it) then you may see an error like "remote: Permission to ermongroup/cs228-notes.git denied to userjanedoe". If that is the case, then you need to fork their repo first. Then, if your github profile were userjanedoe, you would need to first push your local updates to your forked repo like so: 26 | 27 | git push https://github.com/deepgenerativemodels/notes.git master 28 | 29 | And then you could go and submit the pull request through the GitHub website. 30 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | baseurl: /notes 2 | title: Deep Generative Models 3 | subtitle: Lecture notes 4 | author: Aditya Grover 5 | simple_search: http://google.com/search 6 | description: Lecture notes for Deep Generative Models. 7 | name: notes 8 | markdown_ext: "markdown,mkdown,mkdn,mkd,md" 9 | permalink: /articles/:short_year/:title 10 | timezone: America/New_York 11 | excerpt_separator: # you can specify your own separator, of course. 12 | exclude: ['Gemfile', 'Gemfile.lock', 'Rakefile', 'README.md'] 13 | destination: docs 14 | google_analytics: UA-129020129-1 15 | post: 16 | template: _post.txt 17 | extension: md 18 | page: 19 | template: _page.txt 20 | extension: md 21 | editor: gvim 22 | git: 23 | branch: master 24 | transfer: 25 | command: rsync 26 | settings: -av 27 | source: _site/ -------------------------------------------------------------------------------- /_data/options.yml: -------------------------------------------------------------------------------- 1 | mathjax: true 2 | lato_font_load: true -------------------------------------------------------------------------------- /_data/social.yml: -------------------------------------------------------------------------------- 1 | - link: //www.twitter.com/twitter_handle 2 | icon: icon-twitter 3 | - link: //plus.google.com/+googlePlusName 4 | icon: icon-googleplus 5 | - link: //github.com/GithubHandle 6 | icon: icon-github 7 | - link: //www.flickr.com/photos/FlickrUserID 8 | icon: icon-flickr 9 | - link: /feed 10 | icon: icon-feed -------------------------------------------------------------------------------- /_includes/footer.html: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /_includes/head.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 |{{ page.date | date: "%B %-d, %Y" }}
6 | 7 | 8 | {{ content }} 9 | -------------------------------------------------------------------------------- /_layouts/post.html: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | --- 4 |{{ page.date | date: "%B %-d, %Y" }}
6 | 7 | 8 | 32 | 33 | 34 | {{ content }} 35 | 36 | -------------------------------------------------------------------------------- /_plugins/fullwidth.rb: -------------------------------------------------------------------------------- 1 | ## This has a fairly harmless hack that wraps the img tag in a div to prevent it from being 2 | ## wrapped in a paragraph tag instead, which would totally fuck things up layout-wise 3 | ## Usage {% fullwidth 'path/to/image' 'caption goes here in quotes' %} 4 | # 5 | module Jekyll 6 | class RenderFullWidthTag < Liquid::Tag 7 | 8 | require "shellwords" 9 | 10 | def initialize(tag_name, text, tokens) 11 | super 12 | @text = text.shellsplit 13 | end 14 | 15 | def render(context) 16 | baseurl = context.registers[:site].config['baseurl'] 17 | if @text[0].start_with?('http://', 'https://','//') 18 | "These notes form a concise introductory course on deep generative models. 81 | They are based on Stanford CS236, taught by Stefano Ermon and Aditya Grover, and have been written by Aditya Grover, with the help of many students and course staff. 82 | The notes are still under construction! 83 | Since these notes are brand new, you will find several typos. If you do, please let us know, or submit a pull request with your fixes to our Github repository. 84 | You too may help make these notes better by submitting your improvements to us via Github.
85 | 86 |Intelligent agents are constantly generating, acquiring, and processing 81 | data. This data could be in the form of images that we capture on our 82 | phones, text messages we share with our friends, graphs that model 83 | interactions on social media, videos that record important events, 84 | etc. Natural agents excel at discovering patterns, extracting 85 | knowledge, and performing complex reasoning based on the data they observe. How 86 | can we build artificial learning systems to do the same?
87 | 88 |In this course, we will study generative models that view the world under the lens of probability. 89 | In such a worldview, we can think of any kind of 90 | observed data, say , as a finite set of samples from an 91 | underlying distribution, say . At its very core, the 92 | goal of any generative model is then to approximate this data 93 | distribution given access to the dataset . The hope is that 94 | if we are able to learn a good generative model, we can use the 95 | learned model for downstream inference.
96 | 97 |We will be primarily interested in parametric approximations to the data 100 | distribution, which summarize all the information about the dataset in 101 | a finite set of parameters. In contrast with non-parametric models, 102 | parametric models scale more efficiently with large datasets but are 103 | limited in the family of distributions they can represent.
104 | 105 |In the parametric setting, we can think of the task of learning a 106 | generative model as picking the parameters within a family of model 107 | distributions that minimizes some notion of distance1 between the 108 | model distribution and the data distribution.
109 | 110 |
113 |
For instance, we might be given access to a dataset of dog images and 117 | our goal is to learn the paraemeters of a generative model within a model family such that 118 | the model distribution is close to the data distribution over dogs 119 | . Mathematically, we can specify our goal as the 120 | following optimization problem: \begin{equation} 121 | \min_{\theta\in \mathcal{M}}d(p_{\mathrm{data}}, p_{\theta}) 122 | \label{eq:learning_gm} 123 | \tag{1} 124 | \end{equation}where is accessed via the dataset 125 | and is a notion of distance between probability distributions.
126 | 127 |As we navigate through this course, it is interesting to take note of 128 | the difficulty of the problem at hand. A typical image from a modern 129 | phone camera has a resolution of approximately pixels. 130 | Each pixel has three channels: R(ed), G(reen) and B(lue) and each 131 | channel can take a value between 0 to 255. Hence, the number of possible 132 | images is given by . 133 | In contrast, Imagenet, one of the largest publicly available datasets, 134 | consists of only about 15 million images. Hence, learning a generative 135 | model with such a limited dataset is a highly underdetermined problem.
136 | 137 |Fortunately, the real world is highly structured and automatically 138 | discovering the underlying structure is key to learning generative 139 | models. For example, we can hope to learn some basic artifacts about 140 | dogs even with just a few images: two eyes, two ears, fur etc. Instead 141 | of incorporating this prior knowledge explicitly, we will hope the model 142 | learns the underlying structure directly from data. There is no free 143 | lunch however, and indeed successful learning of generative models will 144 | involve instantiating the optimization problem in 145 | in a suitable way. In this course, we will be 146 | primarily interested in the following questions:
147 | 148 |In the next few set of lectures, we will take a deeper dive into certain 155 | families of generative models. For each model family, we will note how 156 | the representation is closely tied with the choice of learning objective 157 | and the optimization procedure.
158 | 159 |For a discriminative model such as logistic regression, the fundamental 162 | inference task is to predict a label for any given datapoint. Generative 163 | models, on the other hand, learn a joint distribution over the entire 164 | data.2
165 | 166 |While the range of applications to which generative models have been 167 | used continue to grow, we can identify three fundamental inference 168 | queries for evaluating a generative model.:
169 | 170 |Density estimation: Given a datapoint , what is the 173 | probability assigned by the model, i.e., ?
174 |Sampling: How can we generate novel data from the model 177 | distribution, i.e., 178 | ?
179 |Unsupervised representation learning: How can we learn meaningful 182 | feature representations for a datapoint ?
183 |Going back to our example of learning a generative model over dog 187 | images, we can intuitively expect a good generative model to work as 188 | follows. For density estimation, we expect to be 189 | high for dog images and low otherwise. Alluding to the name generative 190 | model, sampling involves generating novel images of dogs beyond the 191 | ones we observe in our dataset. Finally, representation learning can 192 | help discover high-level structure in the data such as the breed of 193 | dogs.
194 | 195 |In light of the above inference tasks, we note two caveats. First, 196 | quantitative evaluation of generative models on these tasks is itself 197 | non-trivial (in particular, sampling and representation learning) and an 198 | area of active research. Some quantitative metrics exist, but these 199 | metrics often fail to reflect desirable qualitative attributes in the 200 | generated samples and the learned representations. Secondly, not all 201 | model families permit efficient and accurate inference on all these 202 | tasks. Indeed, the trade-offs in the inference capabilities of the 203 | current generative models have led to the development of very diverse approaches as 204 | we shall see in this course.
205 | 206 |As we shall see later, functions that do not satisfy all 212 | properties of a distance metric are also used in practice, e.g., KL 213 | divergence. ↩
214 |Technically, a probabilistic discriminative model is also a 217 | generative model of the labels conditioned on the data. However, the 218 | usage of the term generative models is typically reserved for high 219 | dimensional data. ↩
220 |