Translating Decision Trees into Rules in Machine Learning

Decision Tree Fundamentals and Concept of Rules

  • Definition of a Decision Tree:

    • A decision tree is a non-parametric supervised learning model used for both classification and regression tasks.
    • It reaches conclusions by sequentially splitting a dataset into smaller, increasingly homogeneous subsets based on specific attribute conditions.
  • Conceptual Analogy:

    • A decision tree functions similarly to a structural flowchart.
    • Decisions are made by answering a chain of sequential questions (conditions) where each path leads closer to a definitive classification or numerical prediction.
  • Real-World Decision Scenario (Umbrella Example):

    • To decide whether to carry an umbrella, a individual evaluates conditions sequentially:
    • Question 1: Is it cloudy?
    • Question 2: Is the weather forecast predicting rain?
    • Question 3: Is it currently raining?
    • Each logical branch directs the user toward a final action: carry an umbrella or do not carry an umbrella.
  • Structural Mechanics of Decision Trees:

    • Splitting Data (Internal Nodes):
    • The tree evaluates feature attributes at each non-terminal node.
    • A test condition partitions the input data into discrete groups, refining the subset characteristics at every subsequent level.
    • Leaf Nodes (Terminal Nodes):
    • Represent the final output, target class label, or predicted numerical value.
    • No further splitting occurs once a leaf node is reached.

Decision Tree Structure Diagram

  • Concept of Rules in Decision Trees:
    • Definition of Rules:
    • Rules are conditional logical statements structured in an IF condition THEN outcome format.
    • In machine learning, rules make decision logic transparent by binding specific feature attribute ranges to target outputs.
    • Rationale for Translating Decision Trees into Rules:
    • Decision trees can become visually unwieldy or complex as depth increases.
    • Converting decision trees into rule sets decomposes complex conditional graphs into modular, readable logic statements that are easily interpretable by domain experts.

Translating Decision Trees to IF-THEN Rules

  • Translation Methodology:

    • Every path from the root node to a leaf node corresponds to a single, complete IF-THEN classification rule.
    • Every internal node along the branch becomes a conjunct (AND condition) in the antecedent (IF part), and the leaf node forms the consequent (THEN part).
  • Example 1: Income and Age Classifier:

    • Consider a decision tree structured with the following conditions:

    • Node 1 (Root): Evaluates if Age<30\text{Age} < 30.

    • Node 2 (Child): Evaluates if Income>50K\text{Income} > 50\text{K}.      Simple Decision Tree for Age and Income

    • Extracted Rule Set:

    • Rule 1: IF Age < 30 AND Income > 50K, THEN prediction is Yes.

    • Rule 2: IF Age < 30 AND Income <= 50K, THEN prediction is No.

    • Rule 3: IF Age >= 30, THEN prediction is No.

  • Example 2: Academic Course Completion Classifier:

    • Decision tree parameters evaluating student performance:
    • Condition 1: Study hours>20\text{Study hours} > 20
    • Condition 2: Attendance>75%\text{Attendance} > 75\%
    • Extracted Rule Set:
    • Rule 1: IF Study hours > 20 AND Attendance > 75%, THEN the student will Pass.
    • Rule 2: IF Study hours > 20 AND Attendance <= 75%, THEN the student will Fail.
    • Rule 3: IF Study hours <= 20, THEN the student will Fail.

Rule Induction Framework and Types

  • Definition of Rule Induction:

    • Rule induction is an iterative machine learning strategy that extracts symbolic IF-THEN rules directly or indirectly from raw training datasets to perform classification and automated decision-making.
    • Standard Rule Structure Example: IF weather = sunny AND temperature > 25°C THEN activity = go swimming.
  • Components of an Induced Rule:

    • Canonical Expression: IF (Condition) THEN (Conclusion)
    • Condition (Antecedent): A logical combination (typically conjuncts using AND) of attribute tests that must evaluate to true for an instance.
    • Conclusion (Consequent): The assigned predicted outcome or class label.
    • Operational Example: IF Age > 30 AND Income = High THEN Class = High Spender.
  • Taxonomy of Rule Induction Techniques:

    • Direct Rule Induction:
    • Extracts decision rules directly from training records without constructing an intermediate statistical or graph-based model.
    • Generates antecedents by evaluating empirical feature distributions directly.
    • Indirect Rule Induction:
    • First builds an explicit intermediate representation (such as an ID3 or C4.5 decision tree).
    • Subsequently parses the intermediate model paths to extract equivalent rule sets.

PlayTennis Benchmark Dataset and Extraction Examples

  • PlayTennis Reference Dataset:
    • Contains 1414 empirical observations across four weather attributes: Outlook, Temperature, Humidity, and Wind to predict PlayTennis (Yes/No).
DayOutlookTemperatureHumidityWindPlayTennis
1SunnyHotHighWeakNo
2SunnyHotHighStrongNo
3OvercastHotHighWeakYes
4RainMildHighWeakYes
5RainCoolNormalWeakYes
6RainCoolNormalStrongNo
7OvercastCoolNormalStrongYes
8SunnyMildHighWeakNo
9SunnyCoolNormalWeakYes
10RainMildNormalWeakYes
11SunnyMildNormalStrongYes
12OvercastMildHighStrongYes
13OvercastHotNormalWeakYes
14RainMildHighStrongNo
  • Direct Rule Induction Execution on PlayTennis Data:

    • Rule 1: IF Outlook = Overcast THEN PlayTennis = Yes
    • Derivation: Days 3, 7, 12, and 13 all feature Outlook = Overcast, and every corresponding label is deterministically Yes.
    • Rule 2: IF Outlook = Sunny AND Humidity = High THEN PlayTennis = No
    • Derivation: Days 1, 2, and 8 show that when Outlook = Sunny and Humidity = High, the output is consistently No.
    • Rule 3: IF Outlook = Rain AND Wind = Weak THEN PlayTennis = Yes
    • Derivation: Days 4, 5, and 10 show that rainy conditions combined with weak wind yield a output of Yes.
  • Indirect Rule Induction Execution on PlayTennis Data:

    • Step 1: Train an Intermediate Decision Tree:

  PlayTennis Decision Tree Flowchart

  • Step 2: Traverse and Extract Root-to-Leaf Paths into Rules:
    1. IF Outlook = Sunny AND Humidity = High THEN PlayTennis = No
    2. IF Outlook = Sunny AND Humidity = Normal THEN PlayTennis = Yes
    3. IF Outlook = Overcast THEN PlayTennis = Yes
    4. IF Outlook = Rain AND Wind = Weak THEN PlayTennis = Yes
    5. IF Outlook = Rain AND Wind = Strong THEN PlayTennis = No

General Rule Induction Process and Sports Car Purchase Example

  • Standard Phased Pipeline of Rule Induction:

    • Phase 1: Data Analysis: Analyze features and target variables to detect underlying statistical patterns.
    • Phase 2: Rule Generation: Formulate initial candidate rules using heuristic correlation or greedy attribute checks.
    • Phase 3: Rule Evaluation: Compute heuristic indicators (such as rule accuracy and instance coverage).
    • Phase 4: Rule Pruning & Refinement: Eliminate redundant or overly specific conjuncts to prevent overfitting.
    • Phase 5: Rule Set Construction: Combine refined rules into an ordered or unordered model set.
    • Phase 6: Classification Execution: Deploy the final rule set to classify unseen instances.
  • Sports Car Target Dataset (88 Records):

AgeIncomeMarital StatusBuys Sports Car
25HighSingleYes
45LowMarriedNo
35MediumSingleYes
50MediumMarriedNo
23HighSingleYes
32LowMarriedNo
28HighSingleYes
40HighMarriedNo
  • Step-by-Step Rule Induction Execution:

    • Rule 1 Induction (Young & Single Analysis):
    • Pattern: Younger, single individuals consistently purchase sports cars.
    • Candidate Rule: IF Age < 30 AND Marital Status = Single THEN Buys Sports Car = Yes
    • Matches Records: (25, High, Single, Yes), (23, High, Single, Yes), (28, High, Single, Yes).
    • Evaluation: Accuracy = 33=100%\frac{3}{3} = 100\%. Rule retained.
    • Rule 2 Induction (Medium Age Single Analysis):
    • Pattern: Single individuals aged 35 with medium income buy sports cars.
    • Candidate Rule: IF Age >= 30 AND Age <= 45 AND Income = Medium AND Marital Status = Single THEN Buys Sports Car = Yes
    • Matches Record: (35, Medium, Single, Yes).
    • Evaluation: Accuracy = 11=100%\frac{1}{1} = 100\%. Rule retained.
    • Rule 3 Induction (Older & Married Analysis):
    • Pattern: Married individuals aged 40 and older do not buy sports cars regardless of income.
    • Candidate Rule: IF Age >= 40 AND Marital Status = Married THEN Buys Sports Car = No
    • Matches Records: (45, Low, Married, No), (50, Medium, Married, No), (40, High, Married, No).
    • Evaluation: Accuracy = 33=100%\frac{3}{3} = 100\%. Rule retained.
    • Rule 4 Induction (Uncovered Records Refinement):
    • Remaining Uncovered Record: (32, Low, Married, No).
    • Candidate Rule: IF Age >= 30 AND Age < 40 AND Income = Low AND Marital Status = Married THEN Buys Sports Car = No
    • Matches Record: (32, Low, Married, No).
    • Evaluation: Accuracy = 11=100%\frac{1}{1} = 100\%. Rule retained.
  • Final Sports Car Rule Set Summary:

    1. IF Age < 30 AND Marital Status = Single THEN Buys Sports Car = Yes
    2. IF Age >= 30 AND Age <= 45 AND Income = Medium AND Marital Status = Single THEN Buys Sports Car = Yes
    3. IF Age >= 40 AND Marital Status = Married THEN Buys Sports Car = No
    4. IF Age >= 30 AND Age < 40 AND Income = Low AND Marital Status = Married THEN Buys Sports Car = No
  • Inference Execution on New Unseen Records:

    • Instance A: Age = 27, Income = High, Marital Status = Single
    • Evaluation: Triggers Rule 1 (Age<30\text{Age} < 30 and Single).
    • Classification: Buys Sports Car = Yes.
    • Instance B: Age = 42, Income = High, Marital Status = Married
    • Evaluation: Triggers Rule 3 (\text{Age} \text{\ge} 40 and Married).
    • Classification: Buys Sports Car = No.
  • Trade-Offs of General Rule Induction:

    • Advantages: High human interpretability; fully transparent decision pathways suitable for high-risk domains like medicine or risk scoring.
    • Limitations: Susceptible to overfitting when conditions match trivial noise; rule counts explode combinatorially on complex, high-dimensional datasets.

Heuristic Rule Induction Methodologies

  • Core Methodology:

    • Uses search heuristics to guide rule generation without exhaustive space traversal.
    • A search heuristic acts as a mathematical guideline (or scoring function) that prioritizes rules maximizing predictive metric trade-offs.
  • Formal Definitions and Metrics:

    • Rule Form: IF condition THEN outcome
    • Coverage: The absolute count of instances in dataset SS satisfying the rule antecedent condition:     Coverage(R)=∣{x∈S∣Condition(x)=true}∣\text{Coverage}(R) = |\{x \in S \mid \text{Condition}(x) = \text{true}\}|
    • Accuracy: The ratio of correct target predictions relative to total covered instances:     Accuracy(R)=∣{x∈S∣Condition(x)=true∧ActualClass(x)=Outcome}∣Coverage(R)\text{Accuracy}(R) = \frac{|\{x \in S \mid \text{Condition}(x) = \text{true} \land \text{ActualClass}(x) = \text{Outcome}\}|}{\text{Coverage}(R)}
  • Worked Example 1: Customer Purchasing Dataset (66 Instances):

Customer IDAgeIncomeBuy (Yes/No)
125HighNo
245MediumYes
335LowNo
450HighYes
523MediumNo
643MediumYes
  • Step-by-Step Heuristic Induction Walkthrough:

    • Step 1: Feature Space Exploration: Focus on Age and Income relative to target Buy.
    • Step 2: Candidate Rule Formulation:
    • Candidate Rule 1: IF Age > 40 THEN Buy = Yes
    • Candidate Rule 2: IF Income = Medium THEN Buy = Yes
    • Candidate Rule 3: IF Age <= 30 THEN Buy = No
    • Step 3: Heuristic Metric Evaluation:
    • Rule 1 Evaluation: Covers Customer 2, 4, 6 (Coverage=3\text{Coverage} = 3). All 3 are Yes. Accuracy = 33=100%\frac{3}{3} = 100\%.
    • Rule 2 Evaluation: Covers Customer 2, 5, 6 (Coverage=3\text{Coverage} = 3). Customers 2 and 6 are Yes, Customer 5 is No. Accuracy = 23≈66.67%\frac{2}{3} \approx 66.67\%.
    • Rule 3 Evaluation: Covers Customer 1, 5 (Coverage=2\text{Coverage} = 2). Both are No. Accuracy = 22=100%\frac{2}{2} = 100\%.
    • Step 4: Rule Selection: Select Rule 1 and Rule 3 based on perfect 100%100\% accuracy.
    • Step 5: Conflict Handling:
    • Conflict Scenario: Customer 5 (Age = 23, Income = Medium) matches Rule 2 (Buy = Yes) and Rule 3 (Buy = No).
    • Resolution Strategy: Prioritize higher accuracy (100%100\% vs 66.67%66.67\%) or select higher specificity rules, discarding Candidate Rule 2.
    • Step 6: Pruning and Generalization:
    • Relax bounds where safe: IF Age > 40 could be relaxed to IF Age > 35 provided accuracy is maintained while expanding coverage.
    • Step 7: Final Heuristic Rule Set:
    1. IF Age > 40 THEN Buy = Yes
    2. IF Age <= 30 THEN Buy = No
    3. IF Income = Medium AND Age > 40 THEN Buy = Yes
  • Heuristic Method Assessment:

    • Advantages: Interpretable outputs, high computational search efficiency, strong empirical generalizability.
    • Limitations: Risk of over-specialization (overfitting); sensitive to heuristic selection bias; struggles to model complex non-linear boundary functions compared to deep neural architectures.

Separate and Conquer Strategy

  • Mechanics of Separate and Conquer:

    • An iterative sequential-covering approach that learns rules one at a time.
    • Separate Phase: Once a rule is learned that covers a subset of positive/negative examples, those covered instances are permanently removed ("separated") from the working dataset.
    • Conquer Phase: The algorithm recursively operates on the remaining reduced dataset ("conquering"), searching for the next optimal rule until all training instances are accounted for.
  • Student Academic Performance Dataset (66 Instances):

Student IDStudy HoursAttendancePass (Yes/No)
18HighYes
25MediumNo
37HighYes
43LowNo
56MediumYes
62LowNo
  • Step-by-Step Execution of Separate and Conquer:
    • Iteration 1 (Initial Dataset Size = 66):
    • Candidate Rule 1: IF Study Hours > 6 THEN Pass = Yes (Covers Students 1, 3; Accuracy = 22=100%\frac{2}{2} = 100\%).
    • Candidate Rule 2: IF Attendance = Low THEN Pass = No (Covers Students 4, 6; Accuracy = 22=100%\frac{2}{2} = 100\%).
    • Action: Select Rule 1 (IF Study Hours > 6 THEN Pass = Yes).
    • Separate: Remove Students 1 and 3.
    • Iteration 2 (Remaining Dataset Size = 44: Students 2, 4, 5, 6):
Student IDStudy HoursAttendancePass (Yes/No)
25MediumNo
43LowNo
56MediumYes
62LowNo
* Action: Learn Rule 2: `IF Attendance = Low THEN Pass = No` (Covers Students 4, 6; Accuracy = 22=100%\frac{2}{2} = 100\%).
* **Separate:** Remove Students 4 and 6.
  • Iteration 3 (Remaining Dataset Size = 22: Students 2, 5):
Student IDStudy HoursAttendancePass (Yes/No)
25MediumNo
56MediumYes
* Action: Learn Rule 3: `IF Study Hours >= 6 THEN Pass = Yes` (Covers Student 5; Accuracy = 11=100%\frac{1}{1} = 100\%).
* **Separate:** Remove Student 5.
  • Iteration 4 (Remaining Dataset Size = 11: Student 2):
Student IDStudy HoursAttendancePass (Yes/No)
25MediumNo
* Action: Learn Rule 4: `IF Study Hours < 6 AND Attendance = Medium THEN Pass = No` (Covers Student 2; Accuracy = 11=100%\frac{1}{1} = 100\%).
* **Separate:** Remove Student 2. Dataset is now empty.
  • Final Extracted Rule Set via Separate and Conquer:

    1. IF Study Hours > 6 THEN Pass = Yes
    2. IF Attendance = Low THEN Pass = No
    3. IF Study Hours >= 6 THEN Pass = Yes
    4. IF Study Hours < 6 AND Attendance = Medium THEN Pass = No
  • Evaluation of Separate and Conquer:

    • Advantages: High interpretability through modular rules; reduces search space drastically at each step; creates highly targeted rules for distinct data sub-regions.
    • Limitations: Late iterations operate on small data subsets, increasing the risk of overfitting noisy outlier points.

Information Gain and Entropy Mathematical Foundations

  • Information Gain (IG):

    • Measures the net reduction in uncertainty (entropy) regarding a target attribute resulting from partitioning data based on feature AA
    • Used as the foundational splitting heuristic in algorithms like ID3 and C4.5.
  • Mathematical Formulation of Entropy:

    • Entropy H(S)H(S) quantifies the degree of impurity or randomness in dataset SS:

H(S)=−∑i=1kpilog⁡2(pi)H(S) = - \sum_{i=1}^{k} p_i \log_2(p_i)

  • Where:

    • kk represents the total number of distinct target classes.

    • pip_i represents the empirical probability of class ii within dataset SS.

    • Mathematical Formulation of Information Gain:

  • Information Gain IG(S,A)IG(S, A) measures the difference between initial system entropy and weighted post-split entropy:

IG(S,A)=H(S)−∑v∈Values(A)∣Sv∣∣S∣H(Sv)IG(S, A) = H(S) - \sum_{v \in \text{Values}(A)} \frac{|S_v|}{|S|} H(S_v)

  • Where:
    • Values(A)\text{Values}(A) is the set of all possible discrete attribute values for feature AA
    • SvS_v is the subset of SS for which feature AA assumes value vv
    • ∣Sv∣|S_v| is the cardinality of subset SvS_v
    • ∣S∣|S| is the total instance count in dataset SS

Information Gain Step-by-Step Mathematical Walkthrough

  • Student Performance Benchmark Dataset (66 Instances):
Student IDStudy HoursAttendancePass (Yes/No)
18HighYes
25MediumNo
37HighYes
43LowNo
56MediumYes
62LowNo
  • Step 1: Calculate Initial Target Entropy H(S)H(S):

    • Target distribution: Pass=Yes\text{Pass} = \text{Yes} (33 instances: Students 1, 3, 5), Pass=No\text{Pass} = \text{No} (33 instances: Students 2, 4, 6).

    • Total instances ∣S∣=6|S| = 6.

    • Class probabilities: pYes=36=0.5p_{\text{Yes}} = \frac{3}{6} = 0.5, pNo=36=0.5p_{\text{No}} = \frac{3}{6} = 0.5.    H(S)=−(36log⁡2(36)+36log⁡2(36))=−(0.5×(−1)+0.5×(−1))=1H(S) = - \left( \frac{3}{6} \log_2\left(\frac{3}{6}\right) + \frac{3}{6} \log_2\left(\frac{3}{6}\right) \right) = - (0.5 \times (-1) + 0.5 \times (-1)) = 1

    • An initial entropy of 11 signifies maximum disorder.

  • Step 2: Calculate Information Gain for Candidate Feature 1 (Study Hours > 5):

    • Test Condition: Split dataset on threshold Study Hours>5\text{Study Hours} > 5
    • Subset 1 (Study Hours>5\text{Study Hours} > 5): Students 1, 3, 5 (33 instances: all 33 are Pass = Yes).

H(S>5)=−(33log⁡2(33))=0H(S_{>5}) = - \left( \frac{3}{3} \log_2\left(\frac{3}{3}\right) \right) = 0

  • Subset 2 (Study Hours≤5\text{Study Hours} \le 5): Students 2, 4, 6 (33 instances: all 33 are Pass = No).

H(S≤5)=−(33log⁡2(33))=0H(S_{\le 5}) = - \left( \frac{3}{3} \log_2\left(\frac{3}{3}\right) \right) = 0

  • Net Information Gain Calculation:

IG(S,Study Hours)=H(S)−(36×H(S>5)+36×H(S≤5))=1−(36×0+36×0)=1IG(S, \text{Study Hours}) = H(S) - \left( \frac{3}{6} \times H(S_{>5}) + \frac{3}{6} \times H(S_{\le 5}) \right) = 1 - \left( \frac{3}{6} \times 0 + \frac{3}{6} \times 0 \right) = 1

  • Step 3: Calculate Information Gain for Candidate Feature 2 (Attendance):
    • Feature Values: High, Medium, Low.
    • Subset 1 (Attendance = High): Students 1, 3 (22 instances: both Pass = Yes).

H(SHigh)=−(22log⁡2(22))=0H(S_{\text{High}}) = - \left( \frac{2}{2} \log_2\left(\frac{2}{2}\right) \right) = 0

  • Subset 2 (Attendance = Medium): Students 2, 5 (22 instances: 11 Pass = Yes, 11 Pass = No).

H(SMedium)=−(12log⁡2(12)+12log⁡2(12))=1H(S_{\text{Medium}}) = - \left( \frac{1}{2} \log_2\left(\frac{1}{2}\right) + \frac{1}{2} \log_2\left(\frac{1}{2}\right) \right) = 1

  • Subset 3 (Attendance = Low): Students 4, 6 (22 instances: both Pass = No).

H(SLow)=−(22log⁡2(22))=0H(S_{\text{Low}}) = - \left( \frac{2}{2} \log_2\left(\frac{2}{2}\right) \right) = 0

  • Net Information Gain Calculation:

IG(S,Attendance)=H(S)−(26H(SHigh)+26H(SMedium)+26H(SLow))=1−(26×0+26×1+26×0)=1−13=23≈0.67IG(S, \text{Attendance}) = H(S) - \left( \frac{2}{6} H(S_{\text{High}}) + \frac{2}{6} H(S_{\text{Medium}}) + \frac{2}{6} H(S_{\text{Low}}) \right) = 1 - \left( \frac{2}{6} \times 0 + \frac{2}{6} \times 1 + \frac{2}{6} \times 0 \right) = 1 - \frac{1}{3} = \frac{2}{3} \approx 0.67

  • Step 4: Feature Selection & Rule Generation:

    • Compare IG: IG(S,Study Hours)=1IG(S, \text{Study Hours}) = 1 vs IG(S,Attendance)≈0.67IG(S, \text{Attendance}) \approx 0.67
    • Study Hours yields higher Information Gain and is selected.
    • Formulate Rule 1: IF Study Hours > 5 THEN Pass = Yes (Covers Students 1, 3, 5).
  • Step 5: Separate Covered Examples & Calculate Remaining Entropy:

    • Remove Students 1, 3, 5. Remaining subset contains Students 2, 4, 6 (all 33 have Pass = No).
    • Calculate Entropy of Remaining Subset SremS_{\text{rem}}:

H(Srem)=−(33log⁡2(33))=0H(S_{\text{rem}}) = - \left( \frac{3}{3} \log_2\left(\frac{3}{3}\right) \right) = 0

  • Because remaining entropy equals 00, the remaining subset is pure.

    • Step 6: Formulate Final Complete Rule Set:
  • IF Study Hours > 5 THEN Pass = Yes

  • IF Study Hours <= 5 THEN Pass = No

    • Information Gain Trade-Offs & Applications:
  • Advantages: Mathematically optimal feature selection; maximizes uncertainty reduction; foundational to algorithms like ID3/C4.5.

  • Limitations: Tends to produce binary splits on numeric features; inherently biased toward high-cardinality features (which can lead to overfitting).

  • Practical Applications: Tree node selection in ID3/C4.5; feature selection preprocessing for dimensional reduction.

First-Order Horn-Clause Induction

  • First-Order Logic (FOL) Fundamentals:
    • FOL extends propositional logic by introducing variables, quantifiers (Universal ∀\forall, Existential ∃\exists), and predicates to articulate multi-relational structures between objects.
    • Horn Clause Definition: A logical clause containing at most one positive literal.
    • Canonical Horn Clause Representation:

if A(x)∧B(x,y) then C(y)\text{if } A(x) \land B(x, y) \text{ then } C(y)

Equivalent Notation: C(y)←A(x)∧B(x,y)\text{Equivalent Notation: } C(y) \leftarrow A(x) \land B(x, y)

  • Interpretation: If predicate AA holds for xx AND predicate BB holds for (x,y)(x, y), then predicate CC holds for yy.

    • Inductive Logic Programming (ILP):
  • ILP combines inductive learning with logic programming to learn relational first-order Horn clauses from structured background knowledge and examples.

    • Worked Example 1: Academic Status Relational Learning:
  • Target Logic: Determine whether Student(Person) is true.

  • Available Predicates: StudiesAt(Person, University), AttendsClasses(Person), HasJob(Person).

  • Positive Examples:

    • Alice: Studies at university, attends classes.
    • Bob: Attends classes, no job.
    • Charlie: Studies at university, no class attendance.
  • Negative Examples:

    • Dave: Has job, no class attendance, no university study.
    • Eve: Has job, no university study, no class attendance.
  • Learned Relational Horn Clauses:

    1. Student(Person)←StudiesAt(Person,University)\text{Student}(\text{Person}) \leftarrow \text{StudiesAt}(\text{Person}, \text{University})
      • Plain Text: If a person studies at a university, they are a student (covers Alice, Charlie).
    2. Student(Person)←AttendsClasses(Person)\text{Student}(\text{Person}) \leftarrow \text{AttendsClasses}(\text{Person})
      • Plain Text: If a person attends classes, they are a student (covers Alice, Bob).
    3. ¬Student(Person)←HasJob(Person)∧¬AttendsClasses(Person)\neg \text{Student}(\text{Person}) \leftarrow \text{HasJob}(\text{Person}) \land \neg \text{AttendsClasses}(\text{Person})
      • Plain Text: If a person has a job and does not attend classes, they are not a student (covers Dave, Eve).
    • Worked Example 2: Mammal Biological Classification:
  • Target Logic: Determine whether Mammal(Animal) is true.

  • Available Predicates: HasFur(Animal), GivesBirth(Animal), LaysEggs(Animal).

  • Positive Examples (Mammals):

    • Cat: Has fur, gives birth.
    • Dog: Has fur, gives birth.
    • Whale: Gives birth, no fur.
  • Negative Examples (Non-Mammals):

    • Bird: Lays eggs, has feathers.
    • Fish: Lays eggs, does not give birth.
  • Learned Relational Horn Clauses:

    1. Mammal(Animal)←GivesBirth(Animal)\text{Mammal}(\text{Animal}) \leftarrow \text{GivesBirth}(\text{Animal})
      • Plain Text: If an animal gives birth, it is a mammal (covers Cat, Dog, Whale).
    2. Mammal(Animal)←HasFur(Animal)\text{Mammal}(\text{Animal}) \leftarrow \text{HasFur}(\text{Animal})
      • Plain Text: If an animal has fur, it is a mammal (covers Cat, Dog).
    3. ¬Mammal(Animal)←LaysEggs(Animal)\neg \text{Mammal}(\text{Animal}) \leftarrow \text{LaysEggs}(\text{Animal})
      • Plain Text: If an animal lays eggs, it is not a mammal (covers Bird, Fish).