pgmpy / pgmpy

Python Library for learning (Structure and Parameter), inference (Probabilistic and Causal), and simulations in Bayesian Networks.
https://pgmpy.org/
MIT License
2.72k stars 708 forks source link

Representation of Factor class #137

Closed ankurankan closed 9 years ago

ankurankan commented 10 years ago

The current values of Factor class is set with the left most variable changing the fastest:

        +-----+-----+-----+-------------------+
        |  x1 |  x2 |  x3 |    phi(x1, x2, x2)|
        +-----+-----+-----+-------------------+
        | x1_0| x2_0| x3_0|     phi.value(0)  |
        +-----+-----+-----+-------------------+
        | x1_1| x2_0| x3_0|     phi.value(1)  |
        +-----+-----+-----+-------------------+
        | x1_0| x2_1| x3_0|     phi.value(2)  |
        +-----+-----+-----+-------------------+
        | x1_1| x2_1| x3_0|     phi.value(3)  |
        +-----+-----+-----+-------------------+
        | x1_0| x2_0| x3_1|     phi.value(4)  |
        +-----+-----+-----+-------------------+
        | x1_1| x2_0| x3_1|     phi.value(5)  |
        +-----+-----+-----+-------------------+
        | x1_0| x2_1| x3_1|     phi.value(6)  |
        +-----+-----+-----+-------------------+
        | x1_1| x2_1| x3_1|     phi.value(7)  |
        +-----+-----+-----+-------------------+

But in Koller's book the representation is with right most variable changing the fastest.

Which representation should we go with? @abinashpanda @gargshashank5

abinashpanda commented 10 years ago

@ankurankan We can go with any representation, it doesn't matter much and I don't think it would take much work to change it. But, I think most of the file formats for pgm define the factor graph (not sure, if you could comment on it), so it is better to go with this. What do you think?

ankurankan commented 10 years ago

@abinashpanda Better to go with which one?

abinashpanda commented 10 years ago

@ankurankan I suggest we would stick with this one. I don't feel any need to change the api again.

On Sat, May 31, 2014 at 8:29 PM, Ankur Ankan notifications@github.com wrote:

@abinashpanda https://github.com/abinashpanda Better to go with which one?

— Reply to this email directly or view it on GitHub https://github.com/pgmpy/pgmpy/issues/137#issuecomment-44750413.

Best Regards,

Abinash Panda

B.Tech Final Year (2014) Electronics Engineering Indian Institute of Technology (BHU), Varanasi +91-9451169612 skype id : panda.abinash

ankurankan commented 10 years ago

@abinashpanda I think we need to change this. Changing the right most variable faster in the standard way. Even file formats (XML Belief Network, XMLBIF etc) represent it in that way. If we stick to our current implementation we will need to convert their representation to our representation (which would be extra computation) and also it will get our users confused.

What do you say?

abinashpanda commented 10 years ago

@ankurankan Ok. I am fine with it. On May 31, 2014 8:54 PM, "Ankur Ankan" notifications@github.com wrote:

@abinashpanda https://github.com/abinashpanda I think we need to change this. Changing the right most variable faster in the standard way. Even file formats (XML Belief Network, XMLBIF etc) represent it in that way. If we stick to our current implementation we will need to convert their representation to our representation (which would be extra computation) and also it will get our users confused.

What do you say?

— Reply to this email directly or view it on GitHub https://github.com/pgmpy/pgmpy/issues/137#issuecomment-44750980.