classification using decision tree

3 vues (au cours des 30 derniers jours)
Silpa K
Silpa K le 5 Oct 2019
Commenté : Silpa K le 12 Oct 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.

Réponse acceptée

Jyothis Gireesh
Jyothis Gireesh le 9 Oct 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
  1 commentaire
Silpa K
Silpa K le 12 Oct 2019
Thank you sir.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Statistics and Machine Learning Toolbox dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by