Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(d) Write code to plot a ROC curve without a package for logistic regression. Vary the prediction thresh- old T E {0, 0.1. 0.2, 0.3,

image text in transcribed
(d) Write code to plot a ROC curve without a package for logistic regression. Vary the prediction thresh- old T E {0, 0.1. 0.2, 0.3, 0.4. 0.5. 0.6, 0.7, 0.8, 0.9, 1), and compute false positive and true positive rates for each threshold. Plot a ROC curve for these points, and compare it with the ROC curve gen- erated with the package in part (c). What are the differences and what changes can you make to get the two ROC curves to become more similar? Problem 4 [Cross validation] 25 points In this problem, you will implement your own k-fold cross- validation algorithm and apply it to two linear classifiers (Logistic Regression and LDA). Use the SPAMBASE dataset for this problem. (a) Implement k-fold cross- validation (CV) for training a model. The CV algorithm consists of the fol- lowing steps: (a) Divide the entire data into & partitions of equal size. (b) Run & experiments. In each experimenti e {1, . . . . A. train on & - 1 partitions and test on the validation set (partition i ). (c) Record the validation error for each experiment. (d) Compute and print the average validation error across all & experiments. (b) Run the CV experiment for logistic regression and LDA for e (5, 10 }. You can use a package for training the logistic regression and LDA models. Print for each model the average validation error for each value ofk. (c) Which model performs better? Compare the results

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Complex Geometry And Dynamics The Abel Symposium 2013

Authors: John Erik Fornaess, Marius Irgens, Erlend Fornaess Wold

1st Edition

3319203371, 9783319203379

More Books

Students also viewed these Mathematics questions