Description Usage Arguments Details Value Examples
used to predict new data with previously defined model
1 | predict_your_model(NB_obj,new_x, pred_type = c('class','raw'),threshold = .Machine$double.eps,eps = 0)
|
NB_obj |
object for Naive bayes classifier |
new_x |
a dataframe of test dataset without labels |
pred_type |
predicted result type, should be 'class' or 'raw' |
threshold |
Value replacing cells with probabilities within eps, default is .Machine$double.eps |
eps |
laplace smoothing parametre, default is 0 |
Notice you should specify the result type in 'class'(return labels) and 'raw'(return probabilities)
predicted result depending on pred_type
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)
r2 = predict_your_model(m2,testx,'class')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.