CSc 8710, DDLP - Fall 2005
Exam 3: Take Home (Due: Wednesday, 7 December - by midnight)
Electronic submission under assignment 10
------------------------------------------------------------
(1) Consider the following deductive database:

    r(1,2).
    r(2,3).
    r(3,4).
    p(X) :- r(X,Y), not q(Y).
    q(X) :- r(Y,X), not p(X).

    Using the paraconsistent relational model and algebra compute the Fitting model. 
    Write the algebraic expressions for paraconsistent relation P and Q. Show the 
    work after each iteration including the intermediate steps (complement, join, 
    project etc) of evaluating the algebraic expression. 

(2) Consider the following transaction database:

   TID	Items
   -------------------------
   01	A, B, C, D
   02	A, B, C, D, E, G
   03	A, C, G, H, K
   04	B, C, D, E, K
   05	D, E, F, H, L
   06	A, B, C, D, L
   07	A, D, F, L
   08	B, I, E, K, L
   09	C, D, F, L
   10	A, B, D, E, K
   11	C, D, H, I, K
   12	C, E, K
   13	B, C, D, F
   14	A, B, C, D
   15	C, H, I, J
   16	A, E, F, H, L
   17	H, K, L
   18	A, D, H, K
   19	D, E, K, L
   20	B, C, D, E, H, L

   Applying the Apriori algorithm with minimum support of 20% and minimum confidence 
   of 75%, find all the association rules in the data set. Give details of your 
   computation at each step. Also specify the confidence for each of the rules you discovered.

(3) Code the Large Item Set generation part of the Apriori algorithm in Prolog. The 
    database items and transactions are available in a file (say db.pl) as:

    items([1,2,3,4,5]).
    db([1,3,4]).
    db([2,3,5]).
    db([1,2,3,5]).
    db([2,5]).

    A sample run is shown below:

    [~/public_html/8710/f05/e3][3:08pm] pl

    ?- ['db.pl'].
    % db.pl compiled 0.00 sec, 1,276 bytes

    Yes
    ?- ['ap.pl'].
    % ap.pl compiled 0.00 sec, 5,896 bytes

    Yes
    ?- apriori(2).
    [1]
    [2]
    [3]
    [5]
    [1, 3]
    [2, 3]
    [2, 5]
    [3, 5]
    [2, 3, 5]

    Yes
    ?- halt.

    Note: The top level predicate is apriori(N) where N is the Minimum Support.