Description Usage Arguments Details Value Examples
We assume that the data follows Gaussian Distribution with small sample size.Continuous Xi we estimated with Guassian Distribution.For categorical and logical Xi, P(Xi|Y) would be calculated with laplace smoothing.all needed info to do bayes inference from train data will be in the object.
1 | myNaiveBayes(x,y,laplace = 0,discre = FALSE,alpha=0.05)
|
x |
A dataframe of train data |
y |
A dataframe or vector of categorical labels |
laplace |
parametre for laplace smoothing, default is 0 |
discre |
paramtre to decide discretization, default is FALSE |
alpha |
Significance level value for discretization, default is 0.05 |
This would give us a 'NB' class object for predicting and printing.To estimate the parameters for a feature's distribution, one must assume a distribution or generate nonparametric models for the features from the training set.If you are dealing with continuous data, a common assumption is that these continuous values are Gaussians. For attributes with missing values, the corresponding table entries are omitted for prediction.
object for Naive bayes classifier
1 2 3 4 5 | x=iris[c(1:40,51:90,101:140),-5]
y=iris[c(1:40,51:90,101:140),5]
testx = iris[c(41:50,91:100,141:150),-5]
m2 = myNaiveBayes(x,y)
m2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.