-
Notifications
You must be signed in to change notification settings - Fork 100
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
New Documentation Structure #327
Merged
Merged
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
df0dd1d
Created new pattern for documentation. Ported first using turing doc …
cgbotta 4ba06f0
Updated style
cgbotta a356863
Merge branch 'TuringLang:master' into master
cgbotta fc6bf5b
Added default weave that handles both directories and addressed gramm…
cgbotta f760b32
Renamed tutorials and added a doc example
cgbotta 0cf7b6a
fixed format
cgbotta 2c17932
Reverted tutorial names back to originals
cgbotta b6fe397
Generated manifest and project files, updated GH Action
cgbotta 59313b6
Generated manifest with proper Julia version
cgbotta 1b1c241
Fixed project files
cgbotta 2590aa4
Updated Tutorial
cgbotta 7116f29
style
cgbotta eb5476e
fix style
cgbotta d4b5ca9
style
cgbotta 9bf0a08
Added calculation of true posterior mean
cgbotta f39de6c
format
cgbotta 637829c
permalink
cgbotta 8fc20b5
Merge branch 'master' into master
yebai d489a10
Added variance calculation
cgbotta b6a2cd9
formatting
cgbotta e9c73cc
formatting
cgbotta 9dce638
Updated tutorial posterior visualizations
cgbotta 6f9c246
Format
cgbotta 8124cac
Calculated density of N-IG properly
cgbotta 38c83a4
Format
cgbotta cfe15eb
Update tutorials/docs-00-getting-started/00_getting-started.jmd
yebai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ Testing/ | |
/*/*/jl_*/ | ||
/Manifest.toml | ||
/test/Manifest.toml | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
--- | ||
title: Getting Started | ||
permalink: /:collection/:name/ | ||
redirect_from: docs/0-gettingstarted/ | ||
weave_options: | ||
error : false | ||
--- | ||
|
||
# Getting Started | ||
|
||
## Installation | ||
|
||
To use Turing, you need to install Julia first and then install Turing. | ||
|
||
### Install Julia | ||
|
||
You will need to install Julia 1.3 or greater, which you can get from [the official Julia website](http://julialang.org/downloads/). | ||
|
||
### Install Turing.jl | ||
|
||
Turing is an officially registered Julia package, so you can install a stable version of Turing by running the following in the Julia REPL: | ||
|
||
```julia | ||
using Pkg | ||
Pkg.add("Turing") | ||
``` | ||
|
||
You can check if all tests pass by running | ||
cgbotta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```julia | ||
Pkg.test("Turing") | ||
``` | ||
|
||
## Example | ||
|
||
Here's a simple example showing Turing in action. | ||
|
||
First, we can load the Turing and StatsPlots modules | ||
|
||
```julia | ||
using Turing | ||
using StatsPlots | ||
``` | ||
|
||
Then, we define a simple Normal model with unknown mean and variance | ||
|
||
```julia | ||
@model function gdemo(x, y) | ||
s² ~ InverseGamma(2, 3) | ||
m ~ Normal(0, sqrt(s²)) | ||
x ~ Normal(m, sqrt(s²)) | ||
return y ~ Normal(m, sqrt(s²)) | ||
end | ||
``` | ||
|
||
Then we can run sampler a sampler to collect results. In this case it is a Hamiltonian Monte Carlo sampler | ||
cgbotta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```julia | ||
chn = sample(gdemo(1.5, 2), HMC(0.1, 5), 1000) | ||
``` | ||
|
||
We can use `describe` to summarise results | ||
|
||
```julia | ||
describe(chn) | ||
``` | ||
|
||
Finally, we can plot the results | ||
|
||
```julia | ||
plot(chn) | ||
``` | ||
|
||
The plots can also be saved | ||
|
||
```julia | ||
savefig("gdemo-plot.png") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would these fields of
permalink
andredirect_from
still work withjmd
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied this structure from all the files in
TuringTutorials/tutorials
, but I am assuming this is read by the build process. Perhaps @devmotion could also advise here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not relevant for weaving at all IIRC, it's just copied to the Markdown output (e.g., https://github.com/TuringLang/TuringTutorialsOutput/blob/main/markdown/00-introduction/00_introduction.md). This is just used by the Jekyll setup in turing.ml AFAIK.