function posteriors = BayesRule( value, liks, priors)
%function posteriors = BayesRule( value, liks, priors)
%Function that returns posterior probability of 3 or 5 given value the value of a feature, likelihood of feature being true, and priors of class 3 and 5

%if pixel value is 255.5, then use likelihoods as is
if value==255.5
    posteriors(1) = (liks(1)*priors(1))/((liks(1)*priors(1))+(liks(2)*priors(2)));
    posteriors(2) = 1-posteriors(1);
%if pixel value is 0.5, then use 1 - likelihoods
else
    posteriors(1) = ((1-liks(1))*priors(1))/(((1-liks(1))*priors(1))+((1-liks(2))*priors(2)));
    posteriors(2) = 1-posteriors(1);
end
    
