Question: Below is a MATLAB question, you can copy and paste to yourMATLAB to do it. NOte that ovarian_dataset should be a built indata in MATLAB:

Below is a MATLAB question, you can copy and paste to yourMATLAB to do it. NOte that ovarian_dataset should be a built indata in MATLAB:

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

clear;clc;close all

%% Cancer Detection
% In this homework you will be using an ensemble of decision treesto detect
% cancer from mass spectrometry data on protein profiles.

%% Read in the data
[x,t] = ovarian_dataset;

% recast so that the variables are column vectors
x=x';
t=vec2ind(t)';
whos

%%
% Each column in |x| represents one of 216 differentpatients.
%
% Each row in |x| represents the ion intensity level at one of the100
% specific mass-charge values for each patient.
%
% The variable |t| has 2 rows of 216 values each of which areeither [1;0],
% indicating a cancer patient, or [0;1] for a normal patient.


%% Build a classification model called Mdl using a TreeBaggerensemble of classification trees
% Turm on the following TreeBagger flags:
% 'Surrogate','on'
% 'PredictorSelection','curvature'
% 'OOBPredictorImportance','on'


% Save the estimate predictor importance in a variable calledimp.
% TreeBagger stores predictor importance estimates in theproperty
% called OOBPermutedPredictorDeltaError.

% Sort the importances into descending order, with the mostimportant first

% Compare the estimates using a bar graph that shows the top 20input
% variables in descending order.
% Hint: You will need to use the YDir atribute of the y axes andset it to 'reverse'.


% Use the Mdl to estimate the presence/absence of cancer and plot aconfusion matrix
t_fit=str2num(cell2mat(predict(Mdl,x)));
ClassNames={'0','1'};
figure;
C=confusionmat(t,t_fit);
plotconfusionmatrix(C,ClassNames)
print('-dpng','ConfusionMatrixTB.png');% save to an eps file

Step by Step Solution

3.52 Rating (162 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To solve the given MATLAB question you can use the following code matlab Copy code clear clc close all Cancer Detection In this homework you will be u... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!