Question: Question: Fit a model ONLY to the OnlineNewsPopularity.csv data set. (use Random Forest algorithm model.) . Calculate the prediction power in terms of error rate.
Question:
- Fit a model ONLY to the "OnlineNewsPopularity.csv" data set. (use Random Forest algorithm model.).
- Calculate the prediction power in terms of error rate. (incorrect prediction rate out of all observations in the test set.)
Using the code below, divide the given data set into training set and test set..DO NOT modify the numbers in set.seed(181215).
data <- read.csv("YOUR_WORKSPACE/OnlineNewsPopularity.csv")
data$shares_binary <- factor(as.numeric(data$shares>median(data$shares)),levels=c(0,1))
n <- nrow(data)
set.seed(181215)
index.train <- sort(sample(1:n,n/2,replace=FALSE))
data.train <- data[index.train,]
data.test <- data[-index.train,]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
