Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

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... 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

Step: 3

blur-text-image

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

Operations Management

Authors: R. Dan Reid, Nada R. Sanders

4th edition

9780470556702, 470325046, 470556706, 978-0470325049

More Books

Students also viewed these Programming questions

Question

Construct a network diagram using AON notation.

Answered: 1 week ago