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:

  1. Fit a model ONLY to the "OnlineNewsPopularity.csv" data set. (use Random Forest algorithm model.).
  2. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!