HazyResearch / deepdive

DeepDive
deepdive.stanford.edu
1.95k stars 539 forks source link

dimmwitted #620

Open melporto opened 7 years ago

melporto commented 7 years ago

Hi, I am trying to use dimmwitted in deepdive to perform marginal inference on a factor graph stored in a database. (1) Do you have some code that transforms a factor graph in a string format into network byte order and bytes?

(2) Given the description below, what is the data type of a variable? Variables variableId long 8 isEvidence bool 1 initialValue double 8 dataType short 2 edgeCount* long 8 cardinality long 8

(3) Do you have some script which which generates a metadata file from a factor graph?

thanks,

melporto commented 7 years ago

I still haven't managed, do you have any hint? thanks,

alldefector commented 7 years ago

Hi @melporto

  1. Yes, there is the dw gibbs subcommand that transforms the text format into binary format. You can find example commands here: https://github.com/HazyResearch/sampler/blob/master/test/text2bin.bats In DeepDive, you'd run it like deepdive env sampler-dw text2bin --help

  2. The binary data format is documented here: https://github.com/HazyResearch/sampler/blob/master/doc/binary_format.md#variables-binary

  3. The metadata file is a simple text line with 4 integers: https://github.com/HazyResearch/sampler/blob/master/doc/binary_format.md#metadata-text Internally, DeepDive generates the file here: https://github.com/HazyResearch/deepdive/blob/master/compiler/compile-config/compile-config-2.01-grounding#L697 If you'd like to manually edit the factor graph data, you could also generate the file manually. If you are interested, you could also check out the intermediate data generated by DeepDive in the run/model/grounding/ and run/model/factorgraph directories. Note that only (compressed) binary files are there and the text format is never stored on disk.