@tbradley @danr
I've been working on what the output should look like for the past 5 days and have been able to figure out what this function should give me. The sample data is as follows:
> HairEyeColor
, , Sex = Male
Eye
Hair Brown Blue Hazel Green
Black 32 11 10 3
Brown 53 50 25 15
Red 10 10 7 7
Blond 3 30 5 8
, , Sex = Female
Eye
Hair Brown Blue Hazel Green
Black 36 9 5 2
Brown 66 34 29 14
Red 16 7 7 7
Blond 4 64 5 8
When applying the function NB, with the given dataset above, with the discrete values and a class, I wish for the function to return priors and likelihood function
In other words, I wish my NaiveBayes function, for when applied with the dataset above (HairEyeColor) to return the folllowing parameters:
A-priori probabilities:
Sex
Male Female
0.4712838 0.5287162
Conditional probabilities:
Hair
Sex Black Brown Red Blond
Male 0.2007168 0.512448 0.1218638 0.1648746
Female 0.1661342 0.456890 0.1182109 0.2587859
Eye
Sex Brown Blue Hazel Green
Male 0.35125448 0.36200717 0.16845878 0.1127957
Female 0.38977636 0.36421725 0.14696486 0.09904153
I was wondering If I could have some help in creating a function which would return the above output from the "HairEyeColor" dataset. I have not had any luck myself since I am struggling where to start with this function
I very much appreciate any help you can give for this
Jennifer