classification using decision tree

7 Ansichten (letzte 30 Tage)
Silpa K
Silpa K am 5 Okt. 2019
Kommentiert: Silpa K am 12 Okt. 2019
I have A=[0.0218 -0.0324 -0.0107 -0.0324 0.0001 -0.0107 -0.0107 -0.0324 -0.0216 0.0001 -0.0162 -0.0324 0.0055 -0.0541 0.0272 -0.0324
0.1355 0.0001 0.0542 0.0651 0.0651 0.0272 0.0542 0.0163 -0.0053 -0.0053].How can I do classification using decision tree using these points my dataset is attached here.The A is the set extracted from Train set.

Akzeptierte Antwort

Jyothis Gireesh
Jyothis Gireesh am 9 Okt. 2019
I am assuming that there may be some problem with the file names as the file ‘ECGFiveDays_TRAIN.xlsx’ contains only 23 records and ‘ECGFiveDays_TEST.xlsx’ contains 861 records. It may not be optimal to fit the decision tree using just 23 records and then evaluate the resulting model on a bigger dataset.
So, for the following code I have taken the liberty of using the bigger dataset as the training data. Please make use of the following code snippet to perform the classification using decision trees.
clear;
trainData = xlsread('ECGFiveDays_TEST.xlsx');
testData = xlsread('ECGFiveDays_TRAIN.xlsx');
tree = fitctree(trainData(:,2:end),trainData(:,1)); %Fit the dataset using decision tree
predictLabels = predict(tree,testData(:,2:end)); %Evaluate on test dataset
trueLabels = testData(:,1);
testAccuracy = sum(predictLabels == trueLabels)/length(trueLabels);
Please go through the following documentation link on fitctree()” if you need any further clarifications on the same

Weitere Antworten (0)

Kategorien

Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by