Skip to content

Commit f5c3943

Browse files
committed
Update README
1 parent ea66453 commit f5c3943

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

README.md

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,37 @@ You can modify the list of AD types in `main.jl`.
1212

1313
## I want to add more models!
1414

15-
You can modify the list of models by adding a new file inside the `models` directory.
15+
You can modify the list of models by adding a new file, `models/{model_name}.jl`.
16+
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+
20+
**Dependencies**
1621

1722
Inside this file, you do not need to call `using Turing` or any of the AD backends.
1823
However, you will have to make sure to import any other packages that your model uses.
24+
(If this package is a new dependency, you will also have to add it to `Project.toml`.)
25+
26+
**Model definition and creation**
1927

20-
This file should have, as the final line, the creation of the Turing model object using `model = model_f(...)`.
28+
Each file in `models/` is evaluated within its own module, so you can declare data variables, etc. without worrying about name clashes.
29+
30+
Once you have defined your model as `@model function model_name(...)`, you will need to create a model object.
31+
As the final line in the file, the creation of the Turing model object using `model = model_name(...)`.
2132
(It is mandatory for the model object to be called `model`.)
2233

23-
Then, inside `main.jl`, call `@include_model category_heading model_name`.
34+
**Inclusion in `main.jl`**
2435

25-
- `category_heading` is a string that is used to determine which table the model appears under on the website.
26-
- For the automated tests to run properly, `model_name` **must** be consistent between the following:
27-
- The name of the model itself i.e. `@model function model_name(...)`
28-
- The filename i.e. `models/model_name.jl`
29-
- The name of the model in `main.jl` i.e. `@include_model "Category Heading" model_name`
36+
Finally, inside `main.jl`, call `@include_model category_heading model_name`.
37+
Both `category_heading` and `model_name` should be strings.
3038

31-
Ideally, `model_name` would be self-explanatory, i.e. it would serve to illustrate exactly one feature and the name would indicate this.
32-
However, if necessary, you can add explanatory comments inside the model definition file.
39+
`category_heading` is a string that is used to determine which table the model appears under on the website.
40+
41+
Note that for CI to run properly, `model_name` **must** be consistent between the following:
3342

34-
You can see the existing files in that directory for examples.
43+
- The name of the model itself i.e. `@model function model_name(...)`
44+
- The filename i.e. `models/model_name.jl`
45+
- The name of the model in `main.jl` i.e. `@include_model "Category Heading" "model_name"`
3546

3647
> [!NOTE]
3748
> This setup does admittedly feel a bit complicated.

0 commit comments

Comments
 (0)