3. Suppose we run an online news aggregation platform which observes a person\'s
ID: 3272145 • Letter: 3
Question
3. Suppose we run an online news aggregation platform which observes a person's habits of reading online news articles in order to recommend other articles the user might want to read. Suppose that we have characterised each online article by whether it mentions celebrity, whether it features sports, whether it features politics, and whether it features technology. Suppose we are given the examples below about whether a specific user reads various online articles. We want to use this data set to train a model that predicts which article this person would like to read based on the mentioned features. (a) Suppose you would like to use decision tree learning for this task. Apply the TDIDT algorithm to learn a decision tree. Stop extending a branch of the decision tree when all remaining training examples have the same target feature. Demonstrate how you compute the information gain for (7 marks) the features at each node. Draw the resulting decision tree. (b) Suppose you would like to use naive Bayesian learning for this task. Apply naive Bayesian learning algorithm to approximate P(Reads true), P(X | Reads-true), and P(X Reads falseExplanation / Answer
Only the Naive Bayes technique is illustrated here using the R software.
The data is first entered in a spreadsheet and the text is copied. Using the read.csv function, the data is imported in R. The R package e1071 is loaded and then the naiveBayes function is used to build the Laplace smoothing. For the test case, predict function is applied to make the prediction.
> reads <- read.csv("clipboard",sep=" ",header=TRUE)
> reads$Reads <- as.factor(reads$Reads)
> library(e1071)
> readNB <- naiveBayes(Reads~.,reads[,-1])
> predict(readNB,newdata=(list(Celebrity=FALSE,Sports=TRUE,Politics=FALSE,Technology=TRUE)))
[1] FALSE
Levels: FALSE TRUE
> reads
Case Celebrity Sports Politics Technology Reads
1 E1 FALSE FALSE TRUE TRUE TRUE
2 E2 TRUE TRUE FALSE TRUE FALSE
3 E3 FALSE FALSE FALSE FALSE FALSE
4 E4 TRUE FALSE FALSE FALSE TRUE
5 E5 TRUE FALSE FALSE TRUE FALSE
6 E6 FALSE TRUE FALSE FALSE FALSE
7 E7 FALSE TRUE TRUE TRUE TRUE
8 E8 FALSE TRUE TRUE FALSE FALSE
9 E9 TRUE TRUE TRUE FALSE TRUE
10 E10 FALSE FALSE TRUE FALSE FALSE
11 E11 TRUE TRUE FALSE FALSE TRUE
12 E12 TRUE FALSE TRUE FALSE TRUE
13 E13 FALSE FALSE FALSE TRUE FALSE
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.