New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More Examples for Factor Graph #1913
Comments
@hushell how should the loading/saving of graphs work, could you elaborate a bit? |
Hi, |
@aroma123 and @karlnapf : I was thinking just save/load the CFactorGraph, but it will be nice if we are compatible with UAI format. |
@hushell i cannot agree with UAI has the following syntax:
so in other words we need to define a function in and then of course define the API in |
@hushell same goes for |
@vigsterkr and @hushell : What I understood from the discussion above that:
|
@abinashpanda, as I understood it, there would be no CFactorGraphFile, because you may want to read UAI files and not necessarily use them for factor graphs. Have a look in the examples to how CSVFile is used. CUAIFile should be used in a similar manner, just parsing UAI files instead of CSV files. |
I have another idea. Why do we need to have different classes for different format. Can't we just have multiple functions for CFactorgraph class itself like CFactorgraph::load_from_uai , CFactorgraph::save_to_uai ? This way we can add support for other file formats later. What do you think ? |
@aroma123 in short: not a good idea |
@aroma123, so say that tomorrow I make a Markov network class in Shogun and I want to be able to load Markov networks from UAI files. Then I should make CMarkovNetwork::load_from_uai, CMarkovNetwork::save_to_uai which are going to be pretty much the same as CFactorGraph::load_from_uai and its brother. See the point? |
Okay. Also, I was looking at code @hushell pointed to reuse for uai for implementation. How should .evid files be handled ? |
@aroma123 let's concentrate on UAI itself now... but either it'll have to be a part of |
@vigsterkr So a virtual function for loading evidence should do for now ? |
@aroma123 i'm not so sure if i understand the direct connection between a virtual function and an unimplemented functionality... as said earlier let's concentrate first on UAI itself. |
Understood. Working on it. Get back soon. |
@aroma123 and @abinashpanda: Please read my updated description! |
@hushell this design pattern is completely flawed
it should be |
@vigsterkr Thanks for pointing this out. I was not familiar with IO part at that time. Now I find the correct way, an example is |
Created CUAIFile class (Issue #1913) to save and load file in UAI file format.
Hey @hushell, @abinashpanda , did the part |
@hushell I am currently focusing on MPLP and Graph cut. I will take a look at this issue. Also, I would like to compare it with OpenGM which employs HD5 for reading and saving graphical model. |
This is an entrance task for this project: http://www.shogun-toolbox.org/page/Events/gsoc2014_ideas#sosvmapprox
Currently, no approximate inference implemented with factor graph model in Shogun. This is what we are going to do this summer. In the first step, we could create graphs with loops for later use.
CUAIFile
. A reference of loading function is here: http://cs.nyu.edu/~dsontag/code/README_v2.html. Note that function tables can be computed byCFactorGraph::compute_energies()
, and obtained bySGVector<float64_t> CFactor::get_energies() const
. Add member functionsCFactorGraph::save(CUAIFile*)
andCFactorGraph::load(CUAIFile*)
, whereCUAIFile
should have interim variables to represent an UAI file (according to Viktor's suggestion). To support the loading function, you need to set energy table for each factor. Make sure that you really understandCFactor, CFactorType, CFactorGraph
.The text was updated successfully, but these errors were encountered: