Starting from:

$25

DA5030-Practice 4 Solved

Build an R Notebook of the SMS message ltering example in the textbook on pages 103 to 123 (data set).
Show each step and add appropriate documentation. Note that the attached data set diers slightly from the
one used on the book; the number of cases dier.
Problem 2 
Install the requisite packages to execute the following code that classies the built-in data using Naive
Bayes. Build an R Notebook and explain in detail what each step does. Be sure to look up each function to

library(klaR)
data(iris)
nrow(iris)
summary(iris)
head(iris)
testidx <- which(1:length(iris[, 1]) %% 5 == 0)
# separate into training and testing datasets
iristrain <- iris[-testidx,]
iristest <- iris[testidx,]
# apply Naive Bayes
nbmodel <- NaiveBayes(Species~., data=iristrain)
6/15/2020 Practice 4 - DA5030 | Machine Learning & Data Mining
https://da5030.weebly.com/practice-4.html 2/3
Notes
Producing a word cloud directly from raw text: might produce the error "invalid input 'â£1000' in
'utf8towcs'". There is a solution at stackoverow. Basically you need to remove non-graphical
characters from the raw text using regular expressions (explained in the link).
The function from the tm package is deprecated and no longer available

More products