首页 > 解决方案 > Aleph 无法通过 SWI-Prolog 获得正确的理论

问题描述

我正在尝试将 Aleph 与 SWI-Prolog 一起使用来构建一个理论。但结果似乎不正确。

我的序言文件是:

:- use_module(library(aleph)).
:- if(current_predicate(use_rendering/1)).
:- use_rendering(prolog).
:- endif.
:- aleph.

:- modeh(*,attr2col(+attribute,-attribute)).
:- modeb(*,attrs(+class,+attribute)).
:- modeb(*,type(+attribute,+class)).


:- determination(attr2col/2, type/2).

% Background knowledge
:-begin_bg.
class(clerk).
class(manager).
attrs(clerk,boss).
attribute(boss).
attribute(notype).
attribute(noattrs).
attrs(notype,manager).
attrs(noattribute,clerk).
attrs(noattribute,manager).
type(noattrs,manager).
type(boss,manager).
:-end_bg.

% Positive facts
:-begin_in_pos.
attr2col(boss).
:-end_in_pos.

% Negative facts
:-begin_in_neg.
attr2col(clerk).
attr2col(manager).
attr2col(noattrs).
attr2col(notype).
attr2col(noattribute).
:-end_in_neg.

:-aleph_read_all.

我的输出是:

[theory]

[Rule 1] [Pos cover = 1 Neg cover = 0]
attr2col(boss).

[Training set performance]
         Actual
       +        - 
     + 1        0        1 
Pred 
     - 0        5        5 

       1        5        6 

Accuracy = 1
[Training set summary] [[1,0,0,5]]
[time taken] [0.001164000000000165]
[total clauses constructed] [0]
true.

我想要的是:

attr2col(A) :- attribute(A), attrs(B,A), type(A,C).

aleph 似乎没有用。我不确定哪个部分不正确。也许是模式声明?还是决心部分?但我不知道如何纠正它。

标签: authenticationprologswi-prologinductionaleph-ilp

解决方案


推荐阅读