Skip to content

Commit 86d3f0d

Browse files
committed
Update README
1 parent 3a5b36f commit 86d3f0d

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,45 +14,52 @@ You can modify the list of AD types in `main.jl`.
1414

1515
You can modify the list of models by adding a new file, `models/{model_name}.jl`.
1616

17-
Ideally, `model_name` would be self-explanatory, i.e. it would serve to illustrate exactly one feature and the name would indicate this.
18-
However, if necessary, you can add further explanatory comments inside the model definition file.
19-
2017
The basic structure of this file should look like this, where `model_name` is replaced accordingly:
2118

2219
```julia
2320
#=
24-
You can add any explanatory comments here if necessary
21+
(1) You can add any explanatory comments here if necessary
2522
=#
2623

27-
# Imports if necessary
24+
# (2) Imports if necessary
2825
using MyOtherPackage: some_function
2926

30-
# Define data if necessary
27+
# (3) Define data if necessary
3128
data = ...
3229

30+
# (4) Define the model
3331
@model function model_name(data, ...)
3432
# Define your model here
3533
...
3634
end
3735

38-
# Instantiate the model
36+
# (5) Instantiate the model
3937
model = model_name(data, ...)
4038
```
4139

42-
**Dependencies**
40+
**(1) Model name**
41+
42+
Ideally, `model_name` would be self-explanatory, i.e. it would serve to illustrate exactly one feature and the name would indicate this.
43+
However, if necessary, you can add further explanatory comments inside the model definition file.
44+
45+
**(2) Dependencies**
4346

4447
Inside this file, you do not need to call `using Turing` or any of the AD backends.
4548
(This also means you do not need to import anything that Turing re-exports, such as distributions.)
4649

4750
However, you will have to make sure to import any other packages that your model requires.
4851
(If this package is not already present in the project environment, you will also have to add it to `Project.toml`.)
4952

50-
**Model definition and creation**
53+
**(3) Data definition**
5154

5255
Each file in `models/` is evaluated within its own module, so you can declare data variables, etc. without worrying about name clashes.
5356

57+
**(4) Model definition**
58+
5459
Models can be defined as usual with `@model function model_name(...)`.
5560

61+
**(5) Model instantiation**
62+
5663
The last line in the file should be the creation of the Turing model object using `model = model_name(...)`.
5764
(It is mandatory for the model object to be called `model`.)
5865

0 commit comments

Comments
 (0)