classification using decision tree
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Silpa K
el 5 de Oct. de 2019
Comentada: Silpa K
el 12 de Oct. de 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.
0 comentarios
Respuesta aceptada
Jyothis Gireesh
el 9 de Oct. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!