一. MLN相关知识的介绍

1. First-order logic

  • A first-order logic knowledge base (KB) is a set of formulas in first-order logic;
  • Predicate symbols represent relations among objects in the domain (e.g., Friends) or attributes of objects (e.g., Smokes)
  • An atomic formula is a predicate symbol applied to a tuple of terms.
  • Formulas are recursively constructed from atomic formulas using logical connectives and quantifiers.
  • A term can be a constant, variable, or a function;
  • A ground term is a term containing no variables;
  • A ground atom or ground predicate is an atomic formula all of whose arguments are ground terms.
  • A possible world assigns a truth value to each possible ground predicate.

对于某个自然语言的语句: 例如 "Friends of friends are friends."  我们可以先把他转换为Formula "∀x∀y∀z Fr(x,y) ∧ Fr(y,z) ⇒ Fr(x,z)", 然后把Formula转换为conjunctive normal form (CNF);这样,对于每一个possible world , 我们就可以轻易的知道Formula的Truth Value了;

A first-order KB can be seen as a set of hard constraints on the set of possible worlds: if a world violates even one formula, it has zero probability. The basic idea in MLNs is to soften these constraints: When a world violates one formula in the KB it is less probable, but not impossible. The fewer formulas a world violates, the more probable it is. Each formula has an associated weight that reflects how strong a constraint it is.

2. Markov Networks

这里需要注意几点:

1. Markov network is composed of an undirected graph G and a set of potential function.

2. The graph has a node for each variable, and the model has a potential function for each clique in the graph.

3. Mark Logic

(1) 图的结构

contains one binary node for each possible grounding of each predicate appearing in L.

There is an edge between two nodes iff the corresponding ground predicates appear together in at least one grounding of one formula in L.

(2)构造MLN的例子

Formulas:  ∀x Smoke(x) ⇒ Cancer(x)   ,   ∀x∀y Friends(x,y) ∧ Smoke(x) ⇒ Smoke(y)

M(L,C) can now be used to infer the probability that Anna and Bob are friends given their smoking habits, the probability that Bob has cancer given his friendship with Anna and whether she has cancer, etc.

(3)计算公式

(4) 简化MLNs使用的假设

有了这些假设,就能够从first-order formula中产生a set of ground formulas,从而应用上面的计算公式;

简化过程的伪代码如下:

The last assumption allows us to replace functions by their values when grounding formulas. Thus the only ground predicates that need to be considered are those having constants as argument. The infinite number of terms constructible from all functions and constants in (L, C) can be ignored, because each of those terms corresponds to a known constant in C, and predicates involving them are already represented as the predicates involving the corresponding constants. The possible groundings of a predicate are thus obtained simply by replacing each variable in the predicate with each constant in C, and replacing each function term in the predicate by the corresponding constant.

(4) 怎么表示这3个假设?

(5) 计算概率的一个小例子

(6)如何计算w ?

二. ProbCog

1. 历史渊源 

Alchemy is a Statistical relational AI , recommended by Professor Pedro Domingos ; PyMLNs is a GUI with plug-in capabilities for Alchemy; PyMLNs has been merged into ProbCog;

Alchemy 目前还没有实验成功,可能为依赖库和操作系统的问题 (Fedora Core 7, Bison 2.3, Flex 2.5.4, g++ 4.1.2, Perl 5.8.8)

ProbCog的相关介绍可以点击这里[github]

2. 使用介绍

ProbCog关于MLN部分的使用步骤[github]为:  mlnlearn, mlnquery(infer)

(1) mlnlearn

待训练的MLN: 

包含一些predicates和formulas,注意formulas前面的参数为0,表示还未训练

待训练的db: 

训练出来的结果: 

(2)mlnquery

查询界面:

查询结果:

3. 待研究

(1) mlnlearn参数训练结果的解释

(2) mlnquery查询结果的解释

(3) 使用python脚本操作

MLN 讨论 —— 基础知识的更多相关文章

  1. .NET面试题系列[1] - .NET框架基础知识(1)

    很明显,CLS是CTS的一个子集,而且是最小的子集. - 张子阳 .NET框架基础知识(1) 参考资料: http://www.tracefact.net/CLR-and-Framework/DotN ...

  2. 前端开发:css基础知识之盒模型以及浮动布局。

    前端开发:css基础知识之盒模型以及浮动布局 前言 楼主的蛮多朋友最近都在学习html5,他们都会问到同一个问题 浮动是什么东西?  为什么这个浮动没有效果?  这个问题楼主已经回答了n遍.今天则是把 ...

  3. TCP/IP协议(二)tcp/ip基础知识

    今天凌晨时候看书,突然想到一个问题:怎样做到持续学习?然后得出这样一个结论:放弃不必要的社交,控制欲望,克服懒惰... 然后又有了新的问题:学习效率时高时低,状态不好怎么解决?这也是我最近在思考的问题 ...

  4. Oracle数据库基础知识

    oracle数据库plsql developer   目录(?)[-] 一     SQL基础知识 创建删除数据库 创建删除修改表 添加修改删除列 oracle cascade用法 添加删除约束主键外 ...

  5. Python黑帽编程3.0 第三章 网络接口层攻击基础知识

    3.0 第三章 网络接口层攻击基础知识 首先还是要提醒各位同学,在学习本章之前,请认真的学习TCP/IP体系结构的相关知识,本系列教程在这方面只会浅尝辄止. 本节简单概述下OSI七层模型和TCP/IP ...

  6. .NET Framework基础知识总结

    之前给大家总结了java的面试几次技巧总结,同学们看了觉得还是不错,能够得到大家的认可,感觉还是挺不错的.现在又有同学来想小编索要.NET面试的总结了,好吧.谁让小编这么好呢!以下是.NET面试之框架 ...

  7. 巩固基础知识,从C# in depth开始

    真是书到用时方恨少,平时都是完成任务,书都是看个前面几章就扔书柜了.... 今天看了博客园一篇文章<我们为什么应该坚持写博客>,很有感触,觉得人生不能得过且过,以前为了各种原因,家庭,孩子 ...

  8. js基础知识温习:Javascript中如何模拟私有方法

    本文涉及的主题虽然很基础,在很多人眼里属于小伎俩,但在JavaScript基础知识中属于一个综合性的话题.这里会涉及到对象属性的封装.原型.构造函数.闭包以及立即执行表达式等知识. 公有方法 公有方法 ...

  9. 基础知识系列☞Abstract和Virtual→及相关知识

    转载地址→http://www.cnblogs.com/blsong/archive/2010/08/12/1798064.html 在C#的学习中,容易混淆virtual方法和abstract方法的 ...

随机推荐

  1. Python3+Appium学习笔记07-元素定位工具UI Automator Viewer

    这篇主要说下如何使用UI Automator Viewer这个工具来定位元素.这个工具是sdk自带的.在sdk安装目录Tools目录下找到uiautomatorviewer.bat并启动它 ​ 如果启 ...

  2. 【二进制优化-多重背包】zznu-oj-2120 : 安详--如何用尽钱币打赏主播获得最大好感度

    2120 : 安详 题目描述 spring最近喜欢上了B站新秀主播,身为顿顿吃黄焖鸡的土豪,当然要过去打赏一番,但是spring还是喜欢精打细算,所以在打赏的时候,想要掏出有限的钱,获得主播的最大好感 ...

  3. zznu-oj-2134- 发红包!!!-【多项式加法,模拟题目】

    2134: 发红包!!! 题目描述 给你两个最简多项式,请输出两个多项式相加后的结果.给定的多项式的格式为ax^num1+bx^num2+...其中x前面的a,b代表系数num代表指数(次方数),输入 ...

  4. Find a multiple POJ - 2356 【鸽巢原理应用】

    Problem DescriptionThe input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). E ...

  5. 【基本算法入门-字符串哈希(Hash)】-C++

    字符串哈希入门 说得通俗一点,字符串哈希实质上就是把每个不同的字符串转成不同的整数. 为什么会有这样的需要呢?很明显,存储一个超长的字符串和存储一个超大但是能存的下的整数,后者所占的空间会少的多,但主 ...

  6. redis数据存储--redis在Windows下的安装过程

    一.下载软件 1. 下载Redis windows版本,Redis官网下载地址为:https://redis.io/download: 这里下载的是Windows版本,下载地址为:https://gi ...

  7. 【luogu1468】[Violet]蒲公英--求区间众数

    题目背景 亲爱的哥哥: 你在那个城市里面过得好吗? 我在家里面最近很开心呢.昨天晚上奶奶给我讲了那个叫「绝望」的大坏蛋的故事的说!它把人们的房子和田地搞坏,还有好多小朋友也被它杀掉了.我觉得把那么可怕 ...

  8. 2Dot grammar

    http://www.cnblogs.com/mjios/archive/2013/04/08/3006577.html . #import <Foundation/Foundation.h&g ...

  9. Liunx之基础学习

    用户提权命令之-sudo sudo命令用来以其他身份来执行命令,预设的身份为root.在/etc/sudoers中设置了可执行sudo指令的用户.若其未经授权的用户企图使用sudo,则会发出警告的邮件 ...

  10. 关于pl/sql打开后database为空的问题解决办法

    前置条件:楼主是在虚拟机里面进行安装oracle和pl/sql的,所以我的安装后,发现我的pl/sql显示的database是空的,当然楼主会检查我的tnsnames.ora是不是配置正确了,但是检查 ...