Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 4309B2E0055 for ; Mon, 31 Mar 2008 07:19:36 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 20041-08 for ; Mon, 31 Mar 2008 07:19:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mail.sanbi.ac.za (polka2.sanbi.ac.za [196.38.142.121]) by developer.postgresql.org (Postfix) with ESMTP id 4895B2E0065 for ; Mon, 31 Mar 2008 07:19:35 -0300 (ADT) Received: from localhost.localdomain (this163.sanbi.ac.za [192.168.2.163]) by mail.sanbi.ac.za (Postfix) with ESMTP id 5F6464ACFA3 for ; Mon, 31 Mar 2008 12:19:25 +0200 (SAST) Message-ID: <47F09DD1.1080905@sanbi.ac.za> Date: Mon, 31 Mar 2008 10:16:17 +0200 From: Allan Kamau User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Removing redundant itemsets Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SANBI-MailScanner-Information: Please contact the ISP for more information X-SANBI-MailScanner: Found to be clean X-SANBI-MailScanner-SpamCheck: not spam (whitelisted), SpamAssassin (not cached, score=-1.8, required 5, autolearn=not spam, ALL_TRUSTED -1.80) X-SANBI-MailScanner-From: allank@sanbi.ac.za X-Archive-Number: 200803/203 X-Sequence-Number: 30531 Hi all, I have a list of purchases (market basket) and I would like to select non redundant longest possible patterns by eliminating (creating/populating other table to contain only non redandant itemsets) purchases having item lists which are fully included in at least one other purchase. (Am assuming all the items of all the purchases have met the minimum support currently set at 1) Below is a sample case, table schema and data(DDL and DML) Transaction Itemset '100' 'a','b','c','d' '200' 'c','d' '300' 'a','c','e' '400' 'e','d' On successful removal out of 'redanduant' or smaller purchases having items contained in totality by at least one other purchase, the purchase '200' would be weeded out as it's itemset {'c','d'} is contained in '100' {'a','b','c','d'} purchase. drop sequence if exists togo_seq cascade; create sequence togo_seq; drop table if exists togo cascade; create table togo ( id integer not null default nextval('togo_seq') ,tid char(3) not null ,item char(1) not null ,primary key(id) ,unique(tid,item) ) ; insert into togo(tid,item)values('100','b'); insert into togo(tid,item)values('100','a'); insert into togo(tid,item)values('100','c'); insert into togo(tid,item)values('100','d'); insert into togo(tid,item)values('200','c'); insert into togo(tid,item)values('200','d'); insert into togo(tid,item)values('300','a'); insert into togo(tid,item)values('300','c'); insert into togo(tid,item)values('300','e'); insert into togo(tid,item)values('400','e'); insert into togo(tid,item)values('400','d'); Allan.