Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Refactoring #526

Merged
merged 20 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/.gitignore

This file was deleted.

3 changes: 2 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Gen = "ea4f424c-a589-11e8-07c0-fd5c91b9da4a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"

[compat]
Documenter = "0.27"
Documenter = "1"
16 changes: 16 additions & 0 deletions docs/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Website Docs
limarta marked this conversation as resolved.
Show resolved Hide resolved
- `pages.jl` to find skeleton of website.
- `make.jl` to build the website index.

# How to add tutorials
Currently you must write the tutorial directly in the docs rather than a source file (e.g. Quarto). See `getting_started` or `tutorials` for examples.

Code snippets must use the triple backtick with a label to run. The environment carries over so long as the labels match. Example:

```@example tutorial_1
x = rand()
```

```@example tutorial_1
print(x)
```
6 changes: 0 additions & 6 deletions docs/build_docs_locally.sh

This file was deleted.

42 changes: 12 additions & 30 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
# Run: julia --project make.jl
using Documenter, Gen

include("pages.jl")
makedocs(
sitename = "Gen",
modules = [Gen],
pages = [
"Home" => "index.md",
"Getting Started" => "getting_started.md",
"Tutorials" => "tutorials.md",
"Modeling Languages and APIs" => [
"Generative Functions" => "ref/gfi.md",
"Probability Distributions" => "ref/distributions.md",
"Built-in Modeling Language" => "ref/modeling.md",
"Generative Function Combinators" => "ref/combinators.md",
"Choice Maps" => "ref/choice_maps.md",
"Selections" => "ref/selections.md",
"Optimizing Trainable Parameters" => "ref/parameter_optimization.md",
"Trace Translators" => "ref/trace_translators.md",
"Extending Gen" => "ref/extending.md"
],
"Standard Inference Library" => [
"Importance Sampling" => "ref/importance.md",
"MAP Optimization" => "ref/map.md",
"Markov chain Monte Carlo" => "ref/mcmc.md",
"MAP Optimization" => "ref/map.md",
"Particle Filtering" => "ref/pf.md",
"Variational Inference" => "ref/vi.md",
"Learning Generative Functions" => "ref/learning.md"
],
"Internals" => [
"Optimizing Trainable Parameters" => "ref/internals/parameter_optimization.md",
"Modeling Language Implementation" => "ref/internals/language_implementation.md"
]
]
# linkcheck = true,
limarta marked this conversation as resolved.
Show resolved Hide resolved
doctest = false,
clean = true,
warnonly = true,
# warnonly = [:missing_docs],
format = Documenter.HTML(;
assets = String["assets/header.js", "assets/header.css", "assets/theme.css"]
),
sitename = "Gen.jl",
pages = pages,
)

deploydocs(
Expand Down
53 changes: 53 additions & 0 deletions docs/pages.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
pages = [
"Home" => "index.md",
"Getting Started" => [
"Example 1: Linear Regression" => "getting_started/linear_regression.md",
"Example 2: Hidden Markov Models" => "getting_started/hidden_markov_model.md",
],
"Tutorials" => [
"Basics" => [
"tutorials/modeling_in_gen.md",
"tutorials/combinators.md",
"tutorials/gfi.md",
"tutorials/mcmc.md",
"tutorials/vi.md"
],
"Advanced" => [
"tutorials/modeling_in_gen.md",
"tutorials/trace_translators.md"
# "tutorials/data_driven_proposals.md",
],
"Modeling Languages" => [
"tutorials/languages/static_dsl.md",
"tutorials/languages/extending.md"
],
],
"Modeling Languages and APIs" => [
"Generative Functions" => "api/gfi.md",
"Probability Distributions" => "api/distributions.md",
"Built-in Modeling Language" => "api/modeling.md",
"Generative Function Combinators" => "api/combinators.md",
"Choice Maps" => "api/choice_maps.md",
"Selections" => "api/selections.md",
"Optimizing Trainable Parameters" => "api/parameter_optimization.md",
"Trace Translators" => "api/trace_translators.md",
],
"Standard Inference Library" => [
"Importance Sampling" => "api/importance.md",
"MAP Optimization" => "api/map.md",
"Markov chain Monte Carlo" => "api/mcmc.md",
"MAP Optimization" => "api/map.md",
"Particle Filtering" => "api/pf.md",
"Variational Inference" => "api/vi.md",
"Learning Generative Functions" => "api/learning.md"
],
"Internals" => [
"Optimizing Trainable Parameters" => "api/internals/parameter_optimization.md",
"Modeling Language Implementation" => "api/internals/language_implementation.md"
],
"Miscellanea" => [
"Changelog" => "misc/changelog.md",
"Contributing" => "misc/contributing.md",
"References" => "misc/references.md"
]
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions docs/src/api/gfi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Generative Functions

```@docs
GenerativeFunction
```

add example
```julia
@gen function model()
end
```

The complete set of methods in the generative function interface (GFI) is:
```@docs
simulate
generate
update
regenerate
get_args
get_retval
get_choices
get_score
get_gen_fn
Base.getindex
project
propose
assess
has_argument_grads
accepts_output_grad
accumulate_param_gradients!
choice_gradients
get_params
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions docs/src/api/mcmc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Markov chain Monte Carlo (MCMC)
```@docs
metropolis_hastings
mh
mala
hmc
elliptical_slice
@pkern
@kern
@rkern
reversal
involutive_mcmc
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions docs/src/api/trace_translators.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Trace Translators

```@docs
@transform
@read
@write
@copy
pair_bijections!
is_involution!
inverse
DeterministicTraceTranslator
GeneralTraceTranslator
SimpleExtendingTraceTranslator
SymmetricTraceTranslator
```
7 changes: 7 additions & 0 deletions docs/src/api/vi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Variational inference
There are two procedures in the inference library for performing black box variational inference.
Each of these procedures can also train the model using stochastic gradient descent, as in a variational autoencoder.
```@docs
black_box_vi!
black_box_vimco!
```
138 changes: 138 additions & 0 deletions docs/src/assets/header.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@

@media all and (max-width: 560px) {
header.navigation {
position: fixed !important;
left:0;
top: 0;
width: 100%;
}

header.navigation div.container {
margin-left: 0rem;
}

header.navigation div.container nav.navbar {
min-height: 1rem !important;
}

header.navigation div.container nav.navbar ul.navbar-nav {
min-height: 1rem !important;
margin-left: 0.5rem !important;
}

header.navigation div.container nav.navbar ul.navbar-nav li.small-item {
visibility: visible !important;
display: block !important;
margin: 0.5rem;
}

header.navigation div.container nav.navbar ul.navbar-nav li.nav-item {
visibility: hidden;
display: none;
}

header.navigation div.container nav.navbar ul.navbar-nav li.nav-item a {
visibility: hidden;
display: none;
}

html:not(.theme--documenter-dark) body #documenter .docs-main {
margin-top: 2rem !important;
}
}

@media all and (max-width: 1055px) and (min-width: 561px){
header.navigation {
position: fixed !important;
left:0;
top: 0;
width: 100%;
}

header.navigation div.container {
margin-left: 0rem;
}

header.navigation div.container nav.navbar ul.navbar-nav {
width: 80% !important;
}
}

@media all and (min-width: 1056px) {
header.navigation {
position: fixed !important;
left:0;
top: 0;
width: 100%;
}

header.navigation div.container {
margin-left: 18rem;
}

}

html.theme--documenter-dark header.navigation {
background-color: #1f2424 !important;
}

html.theme--documenter-dark header.navigation div.container {
border-bottom: 1px solid #5e6d6f;
}

html.theme--documenter-dark header.navigation div.container nav.navbar {
background-color: #1f2424 !important;
}

html.theme--documenter-dark header.navigation div.container nav.navbar ul.navbar-nav li.nav-item a.nav-link {
color: white;
transition: color 100ms;
}

html.theme--documenter-dark header.navigation div.container nav.navbar ul.navbar-nav li.nav-item a.nav-link:hover {
color: #0aa8a7
}

html header.navigation {
background-color: white !important;
}

html header.navigation div.container {
border-bottom: 1px solid #dbdbdb;
}

html header.navigation div.container nav.navbar ul.navbar-nav li.nav-item a.nav-link {
color: #222;
transition: color 100ms;
}

html header.navigation div.container nav.navbar ul.navbar-nav li.nav-item a.nav-link:hover {
color: #0aa8a7
}

header.navigation {
z-index: 3;
}

header.navigation div.container nav.navbar ul.navbar-nav {
margin-left: 4rem;
min-height: 3.25rem;
width: 70%;
display: flex;
align-self: auto;
flex-direction: row;
justify-content: space-around;
}

header.navigation div.container nav.navbar ul.navbar-nav li.nav-item {
align-self: stretch;
align-content: space-around;
justify-content: center;
display: flex;
flex-direction: column;
}

header.navigation div.container nav.navbar ul.navbar-nav li.small-item {
visibility: hidden;
display: none;
}
Loading