'No theory in Aleph SWI Prolog
My question is pretty similar to Not getting a theory in Aleph for SWI Prolog
After trying to induce a theory, I end up getting only single atoms
My code(only a snippet of examples included for readability):
% Empty with aleph loaded
:- use_module(library(aleph)).
:- aleph.
:- if(current_predicate(use_rendering/1)).
:- use_rendering(prolog).
:- endif.
% Settings
% Language Bias and Definitions
:- modeh(1,like(+user_id,+restaurant_id)).
:- modeb(1,smoker(+user_id,-smoker)).
:- modeb(1,drink_level(+user_id,-drink_level)).
:- modeb(1,ambience(+user_id,-ambience)).
:- modeb(1,marital_status(+user_id,-marital_status)).
:- modeb(*,lteq(+age,#age)).
:- modeb(1,age(+user_id,-age)).
:- modeb(1,transport(+user_id,-transport)).
:- modeb(1,personality(+user_id,-personality)).
:- modeb(1,religion(+user_id,-religion)).
:- modeb(1,budget(+user_id,-budget)).
:- modeb(*,lteq(+distance,#distance)).
:- modeb(1,distance(+user_id, +restaurant_id,-distance)).
:- modeb(1,alcohol(+restaurant_id,-alcohol)).
:- modeb(1,smoking_area(+restaurant_id,-smoking_area)).
:- modeb(1,other_services(+restaurant_id,-other_services)).
:- modeb(1,price(+restaurant_id,-price)).
:- modeb(1,dress_code(+restaurant_id,-dress_code)).
:- modeb(1,accessibility(+restaurant_id,-accessibility)).
:- modeb(1,area(+restaurant_id,-area)).
:- modeb(1,rambience(+restaurant_id,-rambience)).
:- modeb(1,franchise(+restaurant_id,-franchise)).
:- modeb(1,parking_lot(+restaurant_id,-parking_lot)).
:- determination(like/2,smoker/2).
:- determination(like/2,drink_level/2).
:- determination(like/2,ambience/2).
:- determination(like/2,marital_status/2).
:- determination(like/2,age/2).
:- determination(like/2,transport/2).
:- determination(like/2,personality/2).
:- determination(like/2,religion/2).
:- determination(like/2,budget/2).
:- determination(like/2,distance/3).
:- determination(like/2,alcohol/2).
:- determination(like/2,smoking_area/2).
:- determination(like/2,other_services/2).
:- determination(like/2,price/2).
:- determination(like/2,dress_code/2).
:- determination(like/2,accessibility/2).
:- determination(like/2,area/2).
:- determination(like/2,rambience/2).
:- determination(like/2,franchise/2).
:- determination(like/2,parking_lot/2).
:- determination(like/2,lteq/2).
:-begin_bg.
% Background knowledge here
smoker(user_id1, no).
smoker(user_id10, no).
smoker(user_id100, yes).
drink_level(user_id1, abstemious).
drink_level(user_id10, social_drinker).
drink_level(user_id100, casual_drinker).
ambience(user_id1, family).
ambience(user_id10, family).
ambience(user_id100, friends).
age(user_id1, 33).
age(user_id10, 31).
age(user_id100, 37).
transport(user_id1, on_foot).
transport(user_id10, public).
transport(user_id100, car_owner).
marital_status(user_id1, single).
marital_status(user_id10, single).
marital_status(user_id100, single).
personality(user_id1, thrifty-protector).
personality(user_id10, hard-worker).
personality(user_id100, hunter-ostentatious).
religion(user_id1, none).
religion(user_id10, christian).
religion(user_id100, none).
budget(user_id1, medium).
budget(user_id10, medium).
budget(user_id100, medium).
distance(user_id70, restaurant_id37, 1.5).
distance(user_id5, restaurant_id75, 0.3).
distance(user_id87, restaurant_id62, 2.0).
alcohol(restaurant_id1, no_alcohol_served).
alcohol(restaurant_id10, wine_beer).
alcohol(restaurant_id100, no_alcohol_served).
smoking_area(restaurant_id1, none).
smoking_area(restaurant_id10, section).
smoking_area(restaurant_id100, permitted).
other_services(restaurant_id1, none).
other_services(restaurant_id10, none).
other_services(restaurant_id100, none).
price(restaurant_id1, low).
price(restaurant_id10, low).
price(restaurant_id100, medium).
dress_code(restaurant_id1, informal).
dress_code(restaurant_id10, informal).
dress_code(restaurant_id100, informal).
area(restaurant_id1, closed).
area(restaurant_id10, open).
area(restaurant_id100, closed).
rambience(restaurant_id1, familiar).
rambience(restaurant_id10, quiet).
rambience(restaurant_id100, familiar).
franchise(restaurant_id1, f).
franchise(restaurant_id10, f).
franchise(restaurant_id100, t).
parking_lot(restaurant_id1, none).
parking_lot(restaurant_id10, none).
parking_lot(restaurant_id100, yes).
lteq(X,Y):-
var(Y), !,
X = Y.
lteq(X,Y):-
number(X), number(Y),
X =< Y.
:- end_bg.
:-begin_in_pos.
% Positive individuals here
like(user_id3, restaurant_id1).
like(user_id5, restaurant_id1).
like(user_id6, restaurant_id1).
:-end_in_pos.
:-begin_in_neg.
% Negative individuals here
like(user_id1, restaurant_id1).
like(user_id2, restaurant_id1).
like(user_id4, restaurant_id1).
:-end_in_neg.
:-aleph_read_all.
The output:
[theory]
[Rule 1] [Pos cover = 1 Neg cover = 0]
like(user_id3,restaurant_id1).
[Rule 2] [Pos cover = 1 Neg cover = 0]
like(user_id5,restaurant_id1).
[Rule 3] [Pos cover = 1 Neg cover = 0]
like(user_id6,restaurant_id1).
...
[Training set performance]
Actual
+ -
+ 447 0 447
Pred
- 0 613 613
447 613 1060
Accuracy = 1
[Training set summary] [[447,0,0,613]]
[time taken] [140.047400515]
[total clauses constructed] [87399]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|