1/* 
    2Registration dataset, it contains information about participants in a recent 
    3Seminar on Data Mining. 
    4We would like to find out what type of people attend the parties at the seminar.
    5From 
    6L. De Raedt, H. Blockeel, L. Dehaspe, and W. Van Laer. Three companions for data mining in first order logic. In S. Dzeroski and N. Lavrac, editors, Relational Data Mining, pages 105-139.  Springer-Verlag, 2001.
    7
    8See also The ACE Data Mining System User's Manual
    9http://dtai.cs.kuleuven.be/ACE/doc/ACEuser-1.2.16.pdf
   10
   11Downloaded from 
   12http://dtai.cs.kuleuven.be/static/ACE/doc/
   13*/

?- induce_lm([all],P),test_lm(P,[all],LL,AUCROC,ROC,AUCPR,PR). */

   20:-use_module(library(lemur)).   21
   22:- if(current_predicate(use_rendering/1)).   23:- use_rendering(c3).   24:- use_rendering(lpad).   25:- endif.   26
   27:-lemur.   28
   29:- set_lm(depth_bound,false).   30:- set_lm(neg_ex,given).   31:- set_lm(verbosity,1).   32
   33:- begin_bg.   34company_info(jvt,commercial).
   35company_info(scuf,university).
   36company_info(ucro,university).
   37course(cso,2,introductory).
   38course(erm,3,introductory).
   39course(so2,4,introductory).
   40course(srw,3,advanced).
   41
   42
   43
   44job(J):-
   45	participant(J, _, _, _).
   46company(C):-
   47	participant(_, C, _, _).
   48
   49party_yes :- party(yes).
   50party_no :- party(no).
   51
   52company_type(T):-
   53	company(C),
   54	company_info(C, T).
   55
   56not_company_type(commercial):-
   57  \+ company_type(commercial).
   58
   59not_company_type(university):-
   60  \+ company_type(university).
   61
   62course_len(C, L):-
   63	course(C, L, _).
   64	
   65course_type(C, T):-
   66	course(C, _, T).
   67
   68:- end_bg.   69
   70:- begin_in.   71party(yes):0.5:-
   72  company_type(commercial).
   73
   74party(no):0.5:-
   75  subscription(A),
   76  course_len(A,4),
   77  \+ company_type(commercial).
   78:- end_in.   79
   80fold(all,F):-
   81  findall(I,int(I),F).
   82
   83fold(test,[adams,scott]).
   84fold(train,[blake, king, miller, turner]).
   85
   86output(party/1).
   87
   88input_cw(job/1).
   89input_cw(not_company_type/1).
   90input_cw(company_type/1).
   91input_cw(subscription/1).
   92input_cw(course_len/2).
   93input_cw(course_type/2).
   94input_cw(company/1).
   95input_cw(company_info/2).
   96input_cw(participant/4).
   97input_cw(course/3)/
   98
   99determination(party/1,job/1).
  100determination(party/1,not_company_type/1).
  101determination(party/1,company_type/1).
  102determination(party/1,subscription/1).
  103determination(party/1,course_len/2).
  104determination(party/1,course_type/2).
  105
  106%modeh(*,[party(yes),party(no)],
  107%  [party(yes),party(no)],
  108%  [job/1,company_type/1,subscription/1,course_len/2,course_type/2]).
  109
  110
  111modeh(*,party(yes)).
  112modeh(*,party(no)).
  113
  114modeb(*,job(-#job)).
  115modeb(*,company_type(-#ctype)).
  116modeb(*,not_company_type(-#ctype)).
  117modeb(*,subscription(-sub)).
  118modeb(*,course_len(+sub,-#cl)).
  119modeb(*,course_type(+sub,-#ct)).
  120
  121neg(party(M,yes)):- party(M,no).
  122neg(party(M,no)):- party(M,yes).
  123
  124party(M,P):-
  125  participant(M,_, _, P, _).
  126
  127
  128begin(model(adams)).
  129participant(researcher,scuf,no,23).
  130subscription(erm).
  131subscription(so2).
  132subscription(srw).
  133end(model(adams)).
  134
  135begin(model(blake)).
  136participant(president,jvt,yes,5).
  137subscription(cso).
  138subscription(erm).
  139end(model(blake)).
  140
  141begin(model(king)).
  142participant(manager,ucro,no,78).
  143subscription(cso).
  144subscription(erm).
  145subscription(so2).
  146subscription(srw).
  147end(model(king)).
  148
  149begin(model(miller)).
  150participant(manager,jvt,yes,14).
  151subscription(so2).
  152end(model(miller)).
  153
  154begin(model(scott)).
  155participant(researcher,scuf,yes,94).
  156subscription(erm).
  157subscription(srw).
  158end(model(scott)).
  159
  160begin(model(turner)).
  161participant(researcher,ucro,no,81).
  162subscription(so2).
  163subscription(srw).
  164end(model(turner)).
  165
  166:- fold(all,F),
  167   sample(4,F,FTr,FTe),
  168   assert(fold(rand_train,FTr)),
  169   assert(fold(rand_test,FTe)).