D-K-E / graphical-models

Probabilistic Graphical Models from Scratch with support for LWF Chain Graphs
GNU General Public License v3.0
4 stars 2 forks source link

Missing code examples in documentation #3

Closed ankurankan closed 3 years ago

ankurankan commented 3 years ago

In the documentation at https://d-k-e.github.io/graphical-models/html/index.html, I can see an example of PGModel but for other model types, there are no code examples. Also, it would be nice if you could use a real dataset/model for the examples, but if you are using a toy example, it would be helpful if you could describe it a bit before the code.

Ref: https://github.com/openjournals/joss-reviews/issues/3115

D-K-E commented 3 years ago

Generally speaking, if some functionality does not have a unittest associated to it, I don't mention it. So far I could not find test cases for MarkovNetwork and the ConditionalRandomField. I am fairly sure of their functionality because all of the work is done by PGModel and that is truly tested. I would really appreciate if you can point out to test cases covering markov network and conditional random fields' functionality.

I also thought about the real dataset/model suggestion before as well. However io and model specification is something I am avoiding for now. I'd like to stick to toy examples for testing the core functionality. I'll think of an io strategy later on. The problem is since I define factors as functions, it is easier to work with them statically. For a reasonable io strategy, I need to generate factor functions dynamically. I might use f string literals or decorators or something else. I have not thought about it yet and I don't plan to at this stage if you don't mind.

I also think toy examples I provide seem a little too ad hoc. What would you prefer to see as a description for toy examples ? Would you mind giving an example ?

ankurankan commented 3 years ago

@D-K-E Thanks for the clarification. For the description, I just meant describing the problem statement that the code example is trying to solve in simple words. An example could be the Monte Hall problem example in pgmpy here: https://github.com/pgmpy/pgmpy/blob/dev/examples/Monty%20Hall%20Problem.ipynb. The notebook gives a context of the Monte Hall problem (which is a toy example) and how you would solve something like that using pgmpy.

D-K-E commented 3 years ago

@ankurankan I added some new tests and added a usage examples under Related Pages section of the documentation. As of now, all sub classes of PGModel that is all that can be subjected to inference are documented.

Most my examples are toy examples taken from text books. I'll try to add more real world examples when I have a bit more time. How does it look ?

ankurankan commented 3 years ago

@D-K-E The examples look good, but I am getting errors in running all of them (except the first one). Could you please check?

D-K-E commented 3 years ago

@ankurankan All right, they all should have been fixed now, both in the documentation and the newly added jupyet notebooks