Ubuntu上运行ProbLog程序的基本方法

这篇博客很简单,接上一篇:在Ubuntu上安装并运行DeepProbLog的简单过程_蛐蛐蛐的博客-优快云博客

其实要运行ProbLog代码是相当简单的,如上一篇博客中所说的,首先安装engine:

pip install problog

可以参考其GitHub repo:https://github.com/ML-KULeuven/problog 或者主页:Introduction. — ProbLog: Probabilistic Programming

安装好之后,例如我们想运行这里的例子:

https://github.com/ML-KULeuven/problog/tree/master/test

例如上一篇博客中提到的论文中的“alarm Bayesian network”,具体代码是这样:https://github.com/ML-KULeuven/problog/blob/master/test/4_1_bayesian_net.pl

%System test 4 - a Bayesian network.
%Description: The burglary-alarm-earthquake BN without any people. The alarm goes off in three different cases.
%Query: what is the probability of burglary and what is probability of an earthquake
%Evidence: we know that the alarm has gone off.
%Expected outcome: 
% burglary 0.9896551724137932
% earthquake 0.2275862068965517
0.7::burglary.
0.2::earthquake.

0.9::alarm <- burglary, earthquake.
0.8::alarm <- burglary, \+earthquake.
0.1::alarm <- \+burglary, earthquake.


%%% Evidence
evidence(alarm,true).

%%% Queries
query(burglary).
query(earthquake).

 那么只需要运行:

problog 4_1_bayesian_net.pl

就可以看到结果了。就先简单总结这么多。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值