Relational Data Mining (RDM)
4.5. Theory of RDM
4.5.3. First-order logic and rules
as compared to 10,366 units and 820,030 tuples without typing. The task contained [Pazzani, Kibler, 1992]:
– learning a predicate with six variables of different types and
– 641 randomly selected training examples (233 positive and 408 negative training examples).
Typing is very useful for data mining tasks with limited training data, because it can improve the accuracy of the hypothesis produced without enlarging the data set. However, this effect of typing is reduced as the number of examples increases [Flash et al, 1998; Pazzani, Kibler, 1992].
Existential variables. Consider the hypothesis:
IF (there exists stock w such that StockEvent(x)=StockEvent(w)) AND (Some other statement)
THEN StockPrice(x)>StockPrice(w).
and
The variables w and z are called existential variables. The number of exis- tential variables like w and z provides one of the measurements of the complexity of the learning task. Usually the search for regularities with existential variables is a computational challenge.
and intensionally using two other predicates Up and Down:
where and Predicates Up and Down are given extensionally in Table 4.10.
A literal is a predicateA or its negation The last one is called a negative literal. An unnegated predicate is called a positive literal. A clause body is a conjunction of literals Often we will omit & operator and write as
A Horn clause consists of two components: a clause head and a clause body A clause head, is defined as a single predi- cate. A Horn clause is written in two equivalent forms:
or
where each is a literal. The second form is traditional for mathematical logic and the first form is more common in applications.
A collection of Horn clauses with the same head is called a rule. The collection can consist of a single Horn clause; therefore, a single Horn clause is also called a rule. Mathematically the term collection is equivalent to the OR operator therefore the rule with two bodies and
can be written as
A k-tuple, a functional expression, and a term are the next concepts used in relational approach. A finite sequence of k constants, denoted by is called a k-tuple of constants. A function applied to k-tuples is called a functional expression. A term is
– a constant, – variable or
– functional expression.
Examples of terms are given in table 4.11.
A k-tuple of terms can be constructed as a sequence of k terms. These concepts are used to define the concept of atom. An atom is a predicate symbol applied to a k-tuple of terms. For example, a predicate symbol P can be applied to 2-tuple of terms (v,w), producing an atom P(v,w) of arity 2.
If P is predicate “>” (greater), v=StockPrice(x) and w=StockPrice(y) are two terms then they produce an atom:
StockPrice(x) >StockPrice(y),
that is, price of stock x is greater than price of stock y.
Predicate P uses two terms v and w as its arguments. The number two is the arity of this predicate. If a predicate or function has k arguments, the number k is called arity of the predicate or function symbol. By convention, function and predicate symbols are denoted by Name/Arity. Functions may have variety of values, but predicates may have only Boolean values true and false. The meaning of the rule for a k-arity predicate is the set of k-tuples that satisfy the predicate. A tuple satisfies a rule if it satisfies one of the Horn clauses that define the rule.
A unary (monadic) predicate is a predicate with arity 1. For example, NASDAQ(x) is unary predicate.
Quantifiers.
means “for all”. For example, means that for all stocks, stock prices are non-negative.
means “there exists”. It is a way of stating the existence of some object in the world without explicitly identifying it. For example,
means that
i.e., there is stock x less expensive than SP500 for a given time.
Using the introduced notation, the following clause can be written:
This is a notation typical for Prolog language. As we already mentioned, more traditional logic notation uses the opposite sequence of expressions:
Both clauses are equivalent to the statement: “There is a stock such that if its trade volume is less than 100,000 per day than its price is less than
$100 per share. Combining two quantifiers, a more complex clause can be written:
Predicates defined by a collection of examples are called extensionally defined predicates, and predicates defined by a rule are called intension- ally defined predicates. If predicates defined by rules then inference based on these predicates can be explained in terms of these rules. Similarly, the extensionally defined predicates correspond to the observable facts (or the operational predicates) [Mitchell, Keller, & Kedar-Cabelli, 1986]. A collection of intensionally defined predicates is also called domain knowl- edge or domain theory.
Statements about a particular stock MSFT for a particular trading day can be written as:
StockPrice(MSFT)>83, NASDAQ(MSFT),
TradeVolume(MSFT)=24,229,000.
These statements can be written in clause notation also assuming empty if- part:
StockPrice(MSFT)>83 NASDAQ(MSFT)
TradeVolume(MSFT)= 24,229,000
To execute a logic program in Prolog, a set of clauses S like that presented below should be entered:
Picks (Bill, MSFT) Picks(Mary, INTC) Picks(Bill, AMD) Picks(Bill, INTC) Picks(Paul, RNWK)
If a program is capable of executing logic programs, the following query will get an automatic answer from the program:
Picks(Bill; x)?
This query is equivalent to the question: ”What stock does Bill pick?) The logic program using a set of clauses S as background knowledge will produce a number of answers:
x = MSFT, x = AMD, x = INTC
Similarly Picks(Steve,x)? and Picks(Mary,x)? can be asked. This will pro- duce an answer: x = INTC.
For now, consider Picks(Steve,x)? There are several steps to get this kind of inference:
1. Start search from the first clause;
2. Find any clause whose head has predicate Picks( , ) and the first argument is Steve;
3. If no clause is found return, otherwise go to 4;
4. Associate x with the 2nd argument of the head literal (the value associated with x is output); mark this clause.
5. Repeat 2-4 for unmarked clauses.