我正在尝试使用WARMR在我的数据中找到频繁的关系模式;为此我在SWI-Prolog中使用ALEPH。但是,我正在努力弄清楚如何做到这一点,以及为什么我以前的尝试不起作用。
我想在进行完整数据之前做一个玩具示例工作。为此我拿了玩具"火车"来自aleph包页面的数据: http://www.swi-prolog.org/pack/list?p=aleph
Aleph手册说明了ar
搜索:
ar
实现由WARMR系统进行的关联规则搜索类型的简化形式(参见L.Dehaspe,1998,PhD Thesis,Katholieke Universitaet Leuven)。在这里,Aleph只是找到至少涵盖a的所有规则
预先指定的正例部分。该分数由参数pos_fraction指定。
因此我已插入
:- set(search,ar).
:- set(pos_fraction,0.01).
进入后台文件(并删除:- set(i,2).
))并删除负面示例的.n文件。我还评论了所有的决定和modeh
声明逻辑,我们正在寻找频繁的模式,而不是规则(即在监督的上下文中,头部将是"输出"变量和条款身体 - "输入"试图解释输出),即它是一个无人监督的任务。
现在,原来的trains
数据集正在尝试构建" eastbound"列车。这是通过使用car
,shape
,has_car(train, car)
之类的谓词来完成的。最初所有与这些相关的背景知识都位于.b文件和五个正面示例中(例如{{ 1。}}。)文件中的。+文件(+ 5个负面例子,例如eastbound(east1).
)。保持文件不变(除了上述更改)并且运行eastbound(west1).
不会产生明智的结果(例如,它会返回induce.
等基础术语作为"规则" 。我已经尝试将一些背景知识移动到.f文件中,但这也没有产生任何明智的效果。
我如何构建.f和.b文件?如果我们真的不想解释任何正面的例子(这肯定会构成一个监督问题),而是要找到数据中的频繁模式(无监督问题),那么应该在正面的例子文件中应该怎么做?我错过了什么吗?
任何帮助将不胜感激。
答案 0 :(得分:2)
首先,如果您可以使用原始的WARMR,我认为它更好。但我认为你需要成为一名免费使用的学者。您可以尝试申请许可证。 https://dtai.cs.kuleuven.be/ACE/
为了获得关联规则,我将所需的所有示例放在f文件中。 n文件中可以包含示例,或者我认为是空的。
我唯一要改变的是:
:- set(search,ar).
:- set(pos_fraction,0.01).
在.b文件中。保留确定和模式声明。
set(i,2)
将查询的长度限制为有两个额外的文字(我认为),因此您可能希望它更大。
?-read_all(train).
induce.
然后你会得到一个'好条款',我认为这是经常查询。
[good clauses]
eastbound(A).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), long(B).
[pos cover = 2 neg cover = 0] [pos-neg] [2]
eastbound(A) :-
has_car(A,B), open_car(B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), shape(B,rectangle).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), wheels(B,2).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), load(B,rectangle,3).
[pos cover = 1 neg cover = 0] [pos-neg] [1]
eastbound(A) :-
has_car(A,B), has_car(A,C).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), has_car(A,C).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), has_car(A,C).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), short(B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), closed(B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), shape(B,rectangle).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), wheels(B,2).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), load(B,triangle,1).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), has_car(A,C).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), has_car(A,C).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), long(B).
[pos cover = 2 neg cover = 0] [pos-neg] [2]
eastbound(A) :-
has_car(A,B), open_car(B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), shape(B,rectangle).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), wheels(B,3).
[pos cover = 3 neg cover = 0] [pos-neg] [3]
eastbound(A) :-
has_car(A,B), load(B,hexagon,1).
[pos cover = 1 neg cover = 0] [pos-neg] [1]
eastbound(A) :-
has_car(A,B), has_car(A,C).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), short(B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), open_car(B).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), shape(B,rectangle).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), wheels(B,2).
[pos cover = 5 neg cover = 0] [pos-neg] [5]
eastbound(A) :-
has_car(A,B), load(B,circle,1).
[pos cover = 3 neg cover = 0] [pos-neg] [3]
eastbound(A) :-
has_car(A,B), open_car(B), shape(B,rectangle).
[pos cover = 4 neg cover = 0] [pos-neg] [4]
等等
规则的形式是东行(A): - 等等。但它只是在计算东向的例子。所以把它想象成example_covered(A): - blah blah