Output produced from -o flag in BLOG

29 views
Skip to first unread message

David Wadden

unread,
May 12, 2015, 1:45:38 AM5/12/15
to blog...@googlegroups.com
Hi,

I'd like to be able to dump BLOG modeling outputs in a file for later use. Your user's manual suggests the -o flag. 

When I grab a copy of the universal zip from the release page and call

bin/blog example/burglary -o burglary.json

I get the following in the output file:

[["Burglary",[["false",2.5786625920876856],["true",1.617406082083277]]]]

The manual suggests that the output should contain log probabilities. So, I expected these numbers to be the log of the probabilities given in the terminal output:

======== Query Results =========
Number of samples: 10000
Distribution of values for Burglary
false 0.7233733088174801
true 0.2766266911825274

What's going on ?

Thanks for the help.

Da Tang

unread,
May 12, 2015, 2:08:36 AM5/12/15
to blog...@googlegroups.com
Hi David,

The probabilities in the file written by BLOG are Unnormalized Probabilities, i.e. \sum\limits_x exp(x) does not need to be 1.
To get the posterior probabilities, you need to normalize the output by yourself. For example:

Pr[Burglary = false] = exp(2.5786625920876856) / (exp(2.5786625920876856) + exp(1.617406082083277)) = 0.7233733088174801.
Pr[Burglary = true] = exp(1.617406082083277) / (exp(2.5786625920876856) + exp(1.617406082083277)) = 0.2766266911825274.

I hope this answers your question. 


Best Regards,
Da Tang

在 2015年5月12日星期二 UTC+8下午1:45:38,David Wadden写道:

David Wadden

unread,
May 12, 2015, 11:45:25 AM5/12/15
to blog...@googlegroups.com
Ah I see. Thanks.
Reply all
Reply to author
Forward
0 new messages