function [PCgivenx] = bayesrule(NC,NnotC,NCx,NnotCx)
%NC=number of instances in class C
%NnotC=number of instances not in class C
%NCx=number of instances in class C of type x
%NnotCx=number of instances in classes no C of type x 
%PCgivenx = probability that x belongs in class C
priorC=NC/(NC+NnotC);
priornotC=1-priorC;
numC=priorC*NCx/NC;
numnotC=priornotC*NnotCx/NnotC;
norm=numC+numnotC;
PCgivenx=numC/norm;
end

