Learning predicate

Description

A definition of the problem of learning predicate has_daughter.

Source: PROLOG programming for artificial intelligence, 3rd Edition, Harlow, 2001, ISBN 0-201-40375-7.

Download

Program source code: learning_predicate.pl

Listing

% Figure 19.1  A definition of the problem of learning predicate has_daughter.
 
 
% Learning from family relations
 
% Background knowledge
 
backliteral( parent(X,Y),  [X,Y]).  % A background literal with vars. [X,Y]
 
backliteral( male(X), [X]).
 
backliteral( female(X), [X]).
 
prolog_predicate( parent(_,_)).     % Goal parent(_,_) executed directly by Prolog
prolog_predicate( male(_)).
prolog_predicate( female(_)).
 
parent( pam, bob).
parent( tom, bob).
parent( tom, liz).
parent( bob, ann).
parent( bob, pat).
parent( pat, jim).
parent( pat, eve).
 
female( pam).
male( tom).
male( bob).
female( liz).
female( ann).
female( pat).
male( jim).
female( eve).
 
% Positive examples
 
ex( has_daughter(tom)).       % Tom has a daughter
ex( has_daughter(bob)).
ex( has_daughter(pat)).
 
% Negative examples
 
nex( has_daughter(pam)).      % Pam doen't have a daughter
nex( has_daughter(jim)).
 
start_hyp( [ [has_daughter(X)] / [X] ] ).      % Starting hypothesis

Comments

pl/prolog/pllib/learning_predicate.txt · ostatnio zmienione: 2017/07/17 08:08 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0