MathIsimple

Rule Learning Fundamentals

Understand the foundation of rule learning: rule structure, logical components, propositional vs first-order rules, and conflict resolution strategies.

Module 1 of 7
Intermediate Level
90-120 min

Rule Essence and Structure

Rules in rule learning follow the fundamental structure: "if (rule body) then (rule head)". The rule body is a conjunction (AND combination) of logical literals, and the rule head is the target concept or class label.

Rule Format

HeadBody\text{Head} \leftarrow \text{Body}

Where:

  • Head: Target concept or class (e.g., "approve_loan", "good_credit")
  • Body: Conjunction of conditions (e.g., "income ≥ $50,000 ∧ credit_score ≥ 700")
  • : Logical implication (read as "if body then head")

Example Rule

Credit approval rule:

approve(income50000)(credit_score700)\text{approve} \leftarrow (\text{income} \geq 50000) \land (\text{credit\_score} \geq 700)

This rule states: "If income is at least $50,000 AND credit score is at least 700, then approve the loan."

Logical Components

Atomic Formulas

Atomic formulas are the basic building blocks of rules. They represent simple conditions or predicates that can be evaluated as true or false.

Examples:

  • income50000\text{income} \geq 50000 (attribute-value comparison)
  • color_deeper(X,Y)\text{color\_deeper}(X, Y) (first-order predicate)
  • age=young\text{age} = \text{young} (equality condition)

Logical Connectives

Logical connectives combine atomic formulas to form complex conditions:

AND (∧)

Conjunction: Both conditions must be true. Default in rule body.

OR (∨)

Disjunction: At least one condition must be true.

NOT (¬)

Negation: Condition must be false.

Example:

(income50000)(credit_score700)¬(has_bankruptcy)(\text{income} \geq 50000) \land (\text{credit\_score} \geq 700) \land \neg(\text{has\_bankruptcy})

All three conditions must be satisfied: income ≥ $50k AND credit_score ≥ 700 AND no bankruptcy.

Rule Types

Rules are classified into two main types based on the data they can handle:

Propositional Rules

Handle attribute-value data (tabular data). No variables, directly based on attribute values.

Example:

approve(income50000)(credit_score700)\text{approve} \leftarrow (\text{income} \geq 50000) \land (\text{credit\_score} \geq 700)

Characteristics:

  • • Direct attribute-value comparisons
  • • Suitable for tabular/structured data
  • • Simple and interpretable
  • • Cannot express relationships between entities

First-Order Rules

Handle relational data. Contain variables and predicates, describing relationships between entities.

Example:

better(X,Y)color_deeper(X,Y)stem_more_curled(X,Y)\text{better}(X, Y) \leftarrow \text{color\_deeper}(X, Y) \land \text{stem\_more\_curled}(X, Y)

Characteristics:

  • • Contains variables (X, Y) representing entities
  • • Uses predicates to express relationships
  • • Suitable for relational/network data
  • • More expressive but computationally complex

Comparison

Propositional Rules:

  • ✓ Simple and efficient
  • ✓ Easy to interpret
  • ✗ Limited to tabular data
  • ✗ Cannot express relationships

First-Order Rules:

  • ✓ Handle relational data
  • ✓ Express complex relationships
  • ✗ More complex to learn
  • ✗ Larger search space

Rule Sets and Conflict Resolution

A rule set is a collection of rules that work together to make predictions. When multiple rules apply to the same sample, conflict resolution strategies determine which rule's prediction to use.

Conflict Resolution Strategies

1. Ordered Rules (Priority-based)

Rules are evaluated in a fixed order. The first matching rule's prediction is used. This is the most common approach in sequential covering algorithms.

2. Default Rule

A default rule (usually the majority class) is used when no specific rule matches. Ensures every sample gets a prediction.

3. Meta-Rules

Higher-level rules that determine which lower-level rule to apply based on context or rule characteristics (e.g., accuracy, coverage).

Credit Approval Example

Apply rule learning to credit approval decisions. Learn a rule set that classifies loan applications as approve or reject based on applicant attributes.

Learned Rule Set

Rule IDRuleCoverageAccuracy
1IF income ≥ $50,000 AND credit_score ≥ 700 THEN approve
High
92%
2IF income < $30,000 OR debt_ratio > 0.5 THEN reject
Medium
88%
3IF employment_years ≥ 2 AND credit_score ≥ 650 THEN approve
Medium
85%

Rules are evaluated in order (1 → 2 → 3). If no rule matches, default to reject. Rule 1 has highest priority and covers high-quality applicants.

Rule Set Properties

Sufficiency:

The rule set covers most positive examples (approve cases). Rule 1 handles high-income applicants, Rule 3 handles stable employment cases.

Necessity:

Each rule body contains only necessary conditions. Removing any literal would reduce accuracy or coverage.

Interpretability:

Each rule is human-readable and explainable. Loan officers can understand why an application was approved or rejected, enabling transparent decision-making.

Medical Diagnosis Example

Apply rule learning to medical diagnosis. Learn rules that predict disease presence based on patient symptoms.

Diagnosis Rules

Rule 1: Flu Diagnosis

flu(fever=yes)(cough=yes)(body_ache=yes)\text{flu} \leftarrow (\text{fever} = \text{yes}) \land (\text{cough} = \text{yes}) \land (\text{body\_ache} = \text{yes})

If patient has fever, cough, and body ache, diagnose as flu.

Rule 2: Pneumonia Diagnosis

pneumonia(fever=yes)(cough=yes)(chest_pain=yes)(age65)\text{pneumonia} \leftarrow (\text{fever} = \text{yes}) \land (\text{cough} = \text{yes}) \land (\text{chest\_pain} = \text{yes}) \land (\text{age} \geq 65)

If patient has fever, cough, chest pain, and is 65 or older, diagnose as pneumonia.

Rule 3: Common Cold

cold(cough=yes)(sneezing=yes)¬(fever=yes)\text{cold} \leftarrow (\text{cough} = \text{yes}) \land (\text{sneezing} = \text{yes}) \land \neg(\text{fever} = \text{yes})

If patient has cough and sneezing but no fever, diagnose as common cold.

Conflict Resolution:

Rules are ordered by specificity (most specific first). If multiple rules match, the most specific rule's diagnosis is used. If no rule matches, default to "healthy" or request additional tests.

Advantages and Applications

Key Advantages

  • Interpretable: Human-readable if-then rules
  • Transparent: Easy to explain decisions
  • Domain knowledge integration: Rules can incorporate expert knowledge
  • Knowledge discovery: Reveals patterns in data
  • No black box: Every prediction is traceable

Real-World Applications

  • Credit approval: Loan decision rules
  • Medical diagnosis: Disease prediction from symptoms
  • Fraud detection: Suspicious transaction patterns
  • Quality control: Product defect identification
  • Expert systems: Knowledge-based decision support