@@ -12,26 +12,37 @@ You can modify the list of AD types in `main.jl`.
12
12
13
13
## I want to add more models!
14
14
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**
16
21
17
22
Inside this file, you do not need to call ` using Turing ` or any of the AD backends.
18
23
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**
19
27
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(...) ` .
21
32
(It is mandatory for the model object to be called ` model ` .)
22
33
23
- Then, inside ` main.jl ` , call ` @include_model category_heading model_name ` .
34
+ ** Inclusion in ` main.jl ` **
24
35
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.
30
38
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:
33
42
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" `
35
46
36
47
> [ !NOTE]
37
48
> This setup does admittedly feel a bit complicated.
0 commit comments