predict_your_model: Naive bayes predictor

Description Usage Arguments Details Value Examples

View source: R/nb.R

Description

used to predict new data with previously defined model

Usage

1
predict_your_model(NB_obj,new_x, pred_type = c('class','raw'),threshold = .Machine$double.eps,eps = 0)

Arguments

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

Details

Notice you should specify the result type in 'class'(return labels) and 'raw'(return probabilities)

Value

predicted result depending on pred_type

Examples

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')

sharechanxd/myNBpackage documentation built on Dec. 23, 2021, 1:21 a.m.