1

I’m trying to use Aleph with SWI-Prolog to construct a theory. But the result seems incorrect.

My prolog file is:

:- 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.

My output is:

[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.

What I want is:

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

It seems that aleph didn't work. I'm not sure which part is incorrect. Maybe the mode declaration? Or determination part? But I don't know how to correct it.

false
  • 10,264
  • 13
  • 101
  • 209
Vic
  • 27
  • 1
  • 4
  • There is an error in the modeh declaration of attr2col. You have defined it with two variables (attr2col/2), while you want it with only one. – damianodamiano Jul 10 '20 at 20:31

0 Answers0