02A Homework 06 Logistic, boosting
(1) Write R code for logistic regression, based on QR code for linear regression.
Return beta and compare with built in R function. Take a screenshot of your comparison.
(2) Write R code for extreme gradient boosting, using one layer tree as base function.
(3) Write R code for adaboost, using one layer tree as base classifier.
For (2) and (3), please generate training examples $(x_1, x_2) ~ uniform[0, 1]^2$, and $y = 1$ if $x_1^2 + x_2^2 leq 1$ and $y = 0$ otherwise.
Return nothing for these two functions. In the function, use first 80% of the data as training data, last 20% as testing data. Calculate the training error and testing error for each iteration.
Save the following graph :
1. The classification result. (set two different predicted result as different color or shape)
2. The training error and testing error graph. (x-axis is epoch; y-axis is error, two line in same graph)
Submit 2 files. One R files and one pdf report. In the pdf, there will be at least 5 graphs(1 screenshot, 2 graph for (2), 2 graph for (3)) and corresponding comments. Feel free to add more graphs.
Reviews
There are no reviews yet.