:- ensure_loaded( '../run.pl' ).

rrun :- run([runs_file('runs/concept_learning_run'),
	     results_dir('out/simple_concept_learning_out')]).

exs.   %do nothing with the data, except load it from data/exs.pl

lhood_canonical(Mst,_Mi,LLst,LLi,Ratio) :-
	model_llhood(Mst,LLst),  % compute log-likelihood of Mst
	Ratio is exp(LLst - LLi).


model_llhood(Model,-inf) :-          % Model has zero likelihood if ..
	datum(X,C),                  % .. there exists a datapoint ..
	inconsistent(C,X,Model),     % .. which is inconsistent with Model
	!.
model_llhood(_Model,0).              % hypothesis consistent with the data

inconsistent(pos,(XX,XY),rectangle(_Name,X1,Y1,X2,Y2)) :-
	(XX<X1 ; XX>X2 ; XY<Y1 ; XY>Y2).       % pos outside the rectangle
inconsistent(neg,(XX,XY),rectangle(_Name,X1,Y1,X2,Y2)) :-
	XX>=X1 , XX=<X2 , XY>=Y1 , XY=<Y2.     % neg inside the rectangle
