# 程序代写 STAT318/462 Assignment 1 – cscodehelp代写

STAT318/462 Assignment 1
Question 1 (4 marks: 1 for an advantage, 1 for a disadvantge, 2 for the conditions)
Diadvantages can be difficult to interpret, can be difficult for inference, may not be useful for noisy data, may not be useful when the training data set is small, can overfit the training data. . .
Advantages may be able to better capture nonlinear features, aviod underfitting the training data, better model complex problems, work well with larger training data sets, may provide more accurate predictions . . .
Conditions simple problems, relatively small training data sets, when you’re interested in inference rather than just predictions, when the data is noisy, . . .
As long as their basic arguments are correct give them the marks, but not if incorrect state- ments are made.
Question 2 (6 marks)
(a) (2 marks: 1 for the plot and 1 for labelling)
x = seq(-5,5,length=100) plot(x,
0.69*dnorm(x),
col = “blue”,
type = “l”,
main = “Conditional densities multiplied by their prior probabilities”, ylab = “pi_k f_k”,
xlab = “X”,
lwd=2) points(x,
0.31*dnorm(x,1,sqrt(0.5)), col=”red”,
type=”l”,
lwd=2)
legend(“topright”,
legend = c(“Class 0”, “Class 1”), col = c(“blue”,”red”),
lwd = 3,
text.col = “black”,
horiz = FALSE)
1

Conditional densities multiplied by their prior probabilities
Class 0 Class 1
−4 −2 0 2 4
X
(b) (2 marks: 1 for each point on the boundary)
polyroot(c(log(0.69/(0.31*sqrt(2))) + 1,-2,1/2)) ##  0.9545773-0i 3.0454227+0i
(c) (1 mark: 0.5 for correct classification and 0.5 for reason)
X=3isinclass1becauseP(Y =0|X=3)