<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=First-order_inductive_learner</id>
	<title>First-order inductive learner - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://debianws.lexgopc.com/wiki143/index.php?action=history&amp;feed=atom&amp;title=First-order_inductive_learner"/>
	<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=First-order_inductive_learner&amp;action=history"/>
	<updated>2026-05-04T18:59:29Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>http://debianws.lexgopc.com/wiki143/index.php?title=First-order_inductive_learner&amp;diff=6451702&amp;oldid=prev</id>
		<title>imported&gt;Felix QW: /* Algorithm */</title>
		<link rel="alternate" type="text/html" href="http://debianws.lexgopc.com/wiki143/index.php?title=First-order_inductive_learner&amp;diff=6451702&amp;oldid=prev"/>
		<updated>2023-11-30T21:37:56Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Algorithm&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Use dmy dates|date=September 2017}}&lt;br /&gt;
In [[machine learning]], &amp;#039;&amp;#039;&amp;#039;first-order inductive learner&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;FOIL&amp;#039;&amp;#039;&amp;#039;) is a rule-based learning algorithm.&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
Developed in 1990 by [[Ross Quinlan]],&amp;lt;ref name=&amp;quot;Quinlan1990&amp;quot;&amp;gt;J.R. Quinlan. Learning Logical Definitions from Relations. Machine Learning, Volume 5, Number 3, 1990. [https://doi.org/10.1007%2FBF00117105]&amp;lt;/ref&amp;gt; FOIL learns function-free [[Horn clause]]s, a subset of [[first-order predicate calculus]]. Given positive and negative examples of some concept and a set of background-knowledge [[predicate (mathematical logic)|predicates]], FOIL inductively generates a logical concept definition or rule for the concept. The induced rule must not involve any constants (&amp;#039;&amp;#039;color(X,red)&amp;#039;&amp;#039; becomes &amp;#039;&amp;#039;color(X,Y), red(Y)&amp;#039;&amp;#039;) or function symbols, but may allow negated predicates; recursive concepts are also learnable. &lt;br /&gt;
&lt;br /&gt;
Like the [[ID3 algorithm]], FOIL hill climbs using a metric based on [[information theory]] to construct a rule that covers the data. Unlike ID3, however, FOIL uses a [[separate-and-conquer]] method rather than [[divide and conquer algorithm|divide-and-conquer]], focusing on creating one rule at a time and collecting uncovered examples for the next iteration of the algorithm.{{cn|date=January 2017}}&lt;br /&gt;
&lt;br /&gt;
==Algorithm==&lt;br /&gt;
The FOIL algorithm is as follows:&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;&amp;#039;Input&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;List of examples and predicate to be learned&amp;#039;&amp;#039;&lt;br /&gt;
:&amp;#039;&amp;#039;&amp;#039;Output&amp;#039;&amp;#039;&amp;#039;  &amp;#039;&amp;#039;A set of first-order Horn clauses&amp;#039;&amp;#039; &lt;br /&gt;
:FOIL(&amp;#039;&amp;#039;&amp;#039;Pred&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;Pos&amp;#039;&amp;#039;&amp;#039;, &amp;#039;&amp;#039;&amp;#039;Neg&amp;#039;&amp;#039;&amp;#039;)&lt;br /&gt;
::Let &amp;#039;&amp;#039;&amp;#039;Pos&amp;#039;&amp;#039;&amp;#039; be the positive examples&lt;br /&gt;
::Let &amp;#039;&amp;#039;&amp;#039;Pred&amp;#039;&amp;#039;&amp;#039; be the predicate to be learned&lt;br /&gt;
::Until &amp;#039;&amp;#039;&amp;#039;Pos&amp;#039;&amp;#039;&amp;#039; is empty do:&lt;br /&gt;
:::Let &amp;#039;&amp;#039;&amp;#039;Neg&amp;#039;&amp;#039;&amp;#039; be the negative examples&lt;br /&gt;
:::Set &amp;#039;&amp;#039;&amp;#039;Body&amp;#039;&amp;#039;&amp;#039; to empty&lt;br /&gt;
:::Call LearnClauseBody&lt;br /&gt;
:::Add &amp;#039;&amp;#039;&amp;#039;Pred&amp;#039;&amp;#039;&amp;#039; ← &amp;#039;&amp;#039;&amp;#039;Body&amp;#039;&amp;#039;&amp;#039; to the rule&lt;br /&gt;
:::Remove from &amp;#039;&amp;#039;&amp;#039;Pos&amp;#039;&amp;#039;&amp;#039; all examples which satisfy &amp;#039;&amp;#039;&amp;#039;Body&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
:Procedure LearnClauseBody&lt;br /&gt;
::Until &amp;#039;&amp;#039;&amp;#039;Neg&amp;#039;&amp;#039;&amp;#039; is empty do:&lt;br /&gt;
:::Choose a literal &amp;#039;&amp;#039;&amp;#039;L&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
:::Conjoin &amp;#039;&amp;#039;&amp;#039;L&amp;#039;&amp;#039;&amp;#039; to &amp;#039;&amp;#039;&amp;#039;Body&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
:::Remove from &amp;#039;&amp;#039;&amp;#039;Neg&amp;#039;&amp;#039;&amp;#039; examples that do not satisfy &amp;#039;&amp;#039;&amp;#039;L&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
Suppose FOIL&amp;#039;s task is to learn the concept &amp;#039;&amp;#039;grandfather(X,Y)&amp;#039;&amp;#039; given the relations &amp;#039;&amp;#039;father(X,Y)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;parent(X,Y)&amp;#039;&amp;#039;. Furthermore, suppose our current Body consists of &amp;#039;&amp;#039;grandfather(X,Y) ← parent(X,Z)&amp;#039;&amp;#039;. This can be extended by conjoining Body with any of the literals &amp;#039;&amp;#039;father(X,X)&amp;#039;&amp;#039;, &amp;#039;&amp;#039;father(Y,Z)&amp;#039;&amp;#039;, &amp;#039;&amp;#039;parent(U,Y)&amp;#039;&amp;#039;, or many others – to create this literal, the algorithm must choose both a predicate name and a set of variables for the predicate (at least one of which is required to be present already in an unnegated literal of the clause). If FOIL extends a clause &amp;#039;&amp;#039;grandfather(X,Y) ← true&amp;#039;&amp;#039; by conjoining the literal &amp;#039;&amp;#039;parent(X,Z)&amp;#039;&amp;#039;, it is introducing the new variable &amp;#039;&amp;#039;Z&amp;#039;&amp;#039;. Positive examples now consist of those values &amp;lt;&amp;#039;&amp;#039;X,Y,Z&amp;#039;&amp;#039;&amp;gt; such that &amp;#039;&amp;#039;grandfather(X,Y)&amp;#039;&amp;#039; is true and &amp;#039;&amp;#039;parent(X,Z)&amp;#039;&amp;#039; is true; negative examples are those where &amp;#039;&amp;#039;grandfather(X,Y)&amp;#039;&amp;#039; is true but &amp;#039;&amp;#039;parent(X,Z)&amp;#039;&amp;#039; is false.&lt;br /&gt;
&lt;br /&gt;
On the next iteration of FOIL after &amp;#039;&amp;#039;parent(X,Z)&amp;#039;&amp;#039; has been added, the algorithm will consider all combinations of predicate names and variables such that at least one variable in the new literal is present in the existing clause. This results in a very large search space.&amp;lt;ref&amp;gt;Let &amp;#039;&amp;#039;Var&amp;#039;&amp;#039; be the largest number of distinct variables for any clause in rule &amp;#039;&amp;#039;R&amp;#039;&amp;#039;, excluding the last conjunct. Let &amp;#039;&amp;#039;MaxP&amp;#039;&amp;#039; be the number of predicates with largest [[arity]] &amp;#039;&amp;#039;MaxA&amp;#039;&amp;#039;. Then an approximation of the number of nodes generated to learn &amp;#039;&amp;#039;R&amp;#039;&amp;#039; is: &amp;#039;&amp;#039;NodesSearched ≤ 2 * MaxP * (Var + MaxA – 1)&amp;lt;sup&amp;gt;MaxA&amp;lt;/sup&amp;gt;&amp;#039;&amp;#039;, as shown in Pazzani and Kibler (1992).&amp;lt;/ref&amp;gt; Several extensions of the FOIL theory have shown that additions to the basic algorithm may reduce this search space, sometimes drastically.{{cn|date=January 2017}}&lt;br /&gt;
&lt;br /&gt;
==First-order combined learner==&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;FOCL&amp;#039;&amp;#039;&amp;#039; algorithm&amp;lt;ref name=&amp;quot;Pazzani&amp;quot;&amp;gt;Michael Pazzani and Dennis Kibler. The Utility of Knowledge in Inductive Learning. Machine Learning, Volume 9, Number 1, 1992. [https://doi.org/10.1023%2FA%3A1022628829777]&amp;lt;/ref&amp;gt; (&amp;#039;&amp;#039;First Order Combined Learner&amp;#039;&amp;#039;) extends FOIL in a variety of ways, which affect how FOCL selects literals to test while extending a clause under construction. Constraints on the search space are allowed, as are predicates that are defined on a rule rather than on a set of examples (called &amp;#039;&amp;#039;intensional&amp;#039;&amp;#039; predicates); most importantly a potentially incorrect hypothesis is allowed as an initial approximation to the predicate to be learned. The main goal of FOCL is to incorporate the methods of [[explanation-based learning]] (EBL) into the empirical methods of FOIL.&lt;br /&gt;
&lt;br /&gt;
Even when no additional knowledge is provided to FOCL over FOIL, however, it utilizes an iterative widening search strategy similar to [[iterative deepening depth-first search|depth-first search]]: first FOCL attempts to learn a clause by introducing no free variables. If this fails (no positive gain), one additional free variable per failure is allowed until the number of free variables exceeds the maximum used for any predicate.&lt;br /&gt;
&lt;br /&gt;
===Constraints===&lt;br /&gt;
Unlike FOIL, which does not put typing constraints on its variables, FOCL uses typing as an inexpensive way of incorporating a simple form of background knowledge. For example, a predicate &amp;#039;&amp;#039;livesAt(X,Y)&amp;#039;&amp;#039; may have types &amp;#039;&amp;#039;livesAt(person, location)&amp;#039;&amp;#039;. Additional predicates may need to be introduced, though – without types, &amp;#039;&amp;#039;nextDoor(X,Y)&amp;#039;&amp;#039; could determine whether person &amp;#039;&amp;#039;X&amp;#039;&amp;#039; and person &amp;#039;&amp;#039;Y&amp;#039;&amp;#039; live next door to each other, or whether two locations are next door to each other. With types, two different predicates &amp;#039;&amp;#039;nextDoor(person, person)&amp;#039;&amp;#039; and &amp;#039;&amp;#039;nextDoor(location, location)&amp;#039;&amp;#039; would need to exist for this functionality to be maintained. However, this typing mechanism eliminates the need for predicates such as &amp;#039;&amp;#039;isPerson(X)&amp;#039;&amp;#039; or &amp;#039;&amp;#039;isLocation(Y)&amp;#039;&amp;#039;, and need not consider &amp;#039;&amp;#039;livesAt(A,B)&amp;#039;&amp;#039; when &amp;#039;&amp;#039;A&amp;#039;&amp;#039; and &amp;#039;&amp;#039;B&amp;#039;&amp;#039; are defined to be person variables, reducing the search space. Additionally, typing can improve the accuracy of the resulting rule by eliminating from consideration impossible literals such as &amp;#039;&amp;#039;livesAt(A,B)&amp;#039;&amp;#039; which may nevertheless appear to have a high [[information gain]].&lt;br /&gt;
&lt;br /&gt;
Rather than implementing trivial predicates such as &amp;#039;&amp;#039;equals(X,X)&amp;#039;&amp;#039; or &amp;#039;&amp;#039;between(X,X,Y)&amp;#039;&amp;#039;, FOCL introduces implicit constraints on variables, further reducing search space. Some predicates must have all variables unique, others must have commutativity (&amp;#039;&amp;#039;adjacent(X,Y)&amp;#039;&amp;#039; is equivalent to &amp;#039;&amp;#039;adjacent(Y,X)&amp;#039;&amp;#039;), still others may require that a particular variable be present in the current clause, and many other potential constraints.&lt;br /&gt;
&lt;br /&gt;
===Operational rules===&lt;br /&gt;
Operational rules are those rules which are defined &amp;#039;&amp;#039;extensionally&amp;#039;&amp;#039;, or as a list of tuples for which a predicate is true. FOIL allows only operational rules; FOCL extends its knowledge base to allow combinations of rules called non-operational rules as well as partially defined or incorrect rules for robustness. Allowing for partial definitions reduces the amount of work needed as the algorithm need not generate these partial definitions for itself, and the incorrect rules do not add significantly to the work needed since they are discarded if they are not judged to provide positive information gain. Non-operational rules are advantageous as the individual rules which they combine may not provide information gain on their own, but are useful when taken in conjunction. If a literal with the most information gain in an iteration of FOCL is non-operational, it is operationalized and its definition is added to the clause under construction.&lt;br /&gt;
&lt;br /&gt;
:&amp;#039;&amp;#039;&amp;#039;Inputs&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;Literal to be operationalized, List of positive examples, List of negative examples&amp;#039;&amp;#039;&lt;br /&gt;
:&amp;#039;&amp;#039;&amp;#039;Output&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;Literal in operational form&amp;#039;&amp;#039;&lt;br /&gt;
:Operationalize(Literal, Positive examples, Negative examples)&lt;br /&gt;
::If &amp;#039;&amp;#039;&amp;#039;Literal&amp;#039;&amp;#039;&amp;#039; is operational&lt;br /&gt;
:::Return &amp;#039;&amp;#039;&amp;#039;Literal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
::Initialize &amp;#039;&amp;#039;&amp;#039;OperationalLiterals&amp;#039;&amp;#039;&amp;#039; to the empty set&lt;br /&gt;
::For each clause in the definition of &amp;#039;&amp;#039;&amp;#039;Literal&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
:::Compute information gain of the clause over Positive examples and Negative examples&lt;br /&gt;
::For the clause with the maximum gain&lt;br /&gt;
:::For each literal &amp;#039;&amp;#039;&amp;#039;L&amp;#039;&amp;#039;&amp;#039; in the clause&lt;br /&gt;
::::Add Operationalize(&amp;#039;&amp;#039;&amp;#039;L&amp;#039;&amp;#039;&amp;#039;, Positive examples, Negative examples) to &amp;#039;&amp;#039;&amp;#039;OperationalLiterals&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
An operational rule might be the literal &amp;#039;&amp;#039;lessThan(X,Y)&amp;#039;&amp;#039;; a non-operational rule might be &amp;#039;&amp;#039;between(X,Y,Z) ← lessThan(X,Y), lessThan(Y,Z)&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
===Initial rules===&lt;br /&gt;
The addition of non-operational rules to the knowledge base increases the size of the space which FOCL must search. Rather than simply providing the algorithm with a target concept (e.g. &amp;#039;&amp;#039;grandfather(X,Y)&amp;#039;&amp;#039;), the algorithm takes as input a set of non-operational rules which it tests for correctness and operationalizes for its learned concept. A correct target concept will clearly improve computational time and accuracy, but even an incorrect concept will give the algorithm a basis from which to work and improve accuracy and time.&amp;lt;ref name=&amp;quot;Pazzani&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
*http://www.csc.liv.ac.uk/~frans/KDD/Software/FOIL_PRM_CPAR/foil.html&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Inductive logic programming]]&lt;/div&gt;</summary>
		<author><name>imported&gt;Felix QW</name></author>
	</entry>
</feed>