Use MATLAB’s built in cancer dataset and linear regression to create a simple discriminant function, similar to the following snippet: [X,d] = cancer_dataset; %Type help cancer_dataset for more info...

1 answer below »

Use MATLAB’s built in cancer dataset and linear regression to create a simple discriminant function, similar to the following snippet:


[X,d] = cancer_dataset; %Type help cancer_dataset for more info


w=X'\d(2,:)'; %Training/MSE linear model creation


y=X'*w; %Activation/testing


[X,Y,T,AUC] = perfcurve(d(2,:),y',1);


figure,plot(X,Y) %Visualize


xlabel('False positive rate')


ylabel('True positive rate')


title(['2D ROC, AUC=' num2str(AUC)])


A- Find a subset of input variables for the linear regressor to see if a reduced input space performs better. Test at least 5 subsets (including the full 9-dimensional input) and use ROC AUC as your measure of success.


B- Keep the first half of the data for creating the linear regressor (training) and the second half for testing. Repeat the above for the best subset found in A and report the AUC for train/test. Summarize your observations.

Answered Same DayOct 15, 2021

Answer To: Use MATLAB’s built in cancer dataset and linear regression to create a simple discriminant function,...

Sathishkumar answered on Oct 15 2021
120 Votes
load cancer_dataset
[X,d] = cancer_dataset; %Type help cancer_dataset for more info
w=X'\d(2,:)';
%Training/MSE linear model creation
XX=X';
y=X'*w; %Activation/testing
[X,Y,T,AUC] = perfcurve(d(2,:),y',1);
figure,plot(X,Y) %Visualize
xlabel('False positive rate')
ylabel('True positive rate')
title(['2D ROC, AUC=' num2str(AUC) ])
YY=y;
mdl = fitlm(X,Y)
[mx,my]=size(XX);
[nx,ny]=size(YY);
X1=XX(1:139,:);
Y1=YY(1:139,:);
mdl1 = fitlm(X1,Y1)
w=X1\d(2,1:139)'; %Training/MSE linear model creation
y=Y1; %Activation/testing
[X,Y,T,AUC] = perfcurve(d(2,1:139),y',1);
figure,plot(X,Y)...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here