StatisticalRethinkingJulia / TuringModels.jl

Implementations of the models from the Statistical Rethinking book with Turing.jl
https://statisticalrethinkingjulia.github.io/TuringModels.jl/
MIT License
163 stars 18 forks source link

Link Edition 1 and 2 models #62

Closed rikhuijzer closed 3 years ago

rikhuijzer commented 3 years ago

The file index.md contains links from a model number in Edition 1 or 2, to a model web page like models/africa. However, some of the models of Edition 2 are (nearly) identical to Edition 1, so index.md can link to the same file.

To resolve this issue, someone has to read through Statistical Rethinking Edition 2 and check whether some models are the same as the models defined in this repository. If that is the case, a link has to be added to index.md.

goedman commented 3 years ago

Hi Rik,

Not sure I completely understand your request. Part if it is no doubt my unfamiliarity with Franklin.

  1. If I want to add say a 2nd edition model (e.g. from chapters 5, 6, 7 and 9), the steps are to 1) update index.md and 2) provide a (Literate) script .jl file (in the scripts subdirectory) and 3) create a documentation .md file (in the models subdirectory)?

  2. I don't think there are currently models with the same number which are different between the editions. There are holes in the model numbering for the 2nd edition. If this becomes an issue in the future I think we could split up the script directory in scripts_1ed, script_2ed, etc.

  3. Your question above is the easy case, i.e. we have a script file and an md file, but just the link is missing?

Have you seen examples of using

julia --project -ie 'using Franklin; Franklin.serve()'

from a released package? As the package directory is non-writable I believe.

Yes, I need to study Franklin.jl!

rikhuijzer commented 3 years ago

Yes, I need to study Franklin.jl!

Yeah, no worries. It also took me quite a lot of time to understand Franklin.jl. If I may give a tip, I think it would be easiest to start with creating a new website via the documentation for Franklin.jl. With a new project, the site responds quickly to changes, whereas this project can take quite a while because the Turing models can be quite heavy.

As the package directory is non-writable I believe.

It seems that the manual is a bit unclear. Are you located in TuringModels.jl, like

$ cd TuringModels.jl

$ julia --project -ie 'using Franklin; Franklin.serve()'

If I want to add say a 2nd edition model (e.g. from chapters 5, 6, 7 and 9), the steps are to 1) update index.md and 2) provide a (Literate) script .jl file (in the scripts subdirectory) and 3) create a documentation .md file (in the models subdirectory)?

Correct :+1:

I don't think there are currently models with the same number which are different between the editions. There are holes in the model numbering for the 2nd edition. If this becomes an issue in the future I think we could split up the script directory in scripts_1ed, script_2ed, etc.

I've named the models to avoid this problem. Because the models all have an unique name, we can link anything to anything. If we would split the models in folders, then we cannot avoid duplicate models because the same model in Edition 1 and 2 would be required to be in scripts_1ed and scripts_2ed. So, index.md (the homepage) is literally an index from model number -> name.

Your question above is the easy case, i.e. we have a script file and an md file, but just the link is missing?

Correct :+1:

rikhuijzer commented 3 years ago

Regarding the examples of using —project, it is in the franklin default CI template (https://github.com/tlienart/FranklinTemplates.jl/pull/119) and adding it to the docs is work in progress (https://github.com/tlienart/Franklin.jl/issues/750)