Error while predicting data


I have an issue in R-studio while predicting a dataset with Naivebayes model.

this is the issue :
Error in log(sapply(seq_along(attribs), function(v) { :
non-numeric argument to mathematical function

Can anyone help me on this issue, please ?

thanks you.



Please upload the exact problem with a snapshot of your code and dataset. Then only it would be possible to help you.
But from the look of it, it looks like you passed an incompatible data type variable to one of your function.


Can you please upload the code that you have used.


Hi Danish,

Here is the code in attached document.code segmentation.pdf (103.9 KB)


Thank you Danish for your time spending on this issue.



The file that you have uploaded is blank. Please check it.


Sorry for that. I dont know why it happened so. Uploading again.code segmentation.pdf (103.9 KB)


If still you are facing the same issue , then may I have your emailID please ?
so that I can forward the .doc and pdf both.


@sankar007, please give a reproduceable copy of your code. From the pdf, it seems that the model is not able to predict because the independent variable(segment) has a lot of missing values. It is advisable to treat those missing values before modelling the data. Also, try by converting logical variables into numeric if that does not work.


code (14.9 KB)