Nano'nun Günlüğü…

Ideallerimi gerceklestirmek icin arastiriyorum, Unutmamak icin yaziyorum!

  • Bulundugunuz Sayfa: 
  • Ana Sayfa
  • CART : Classification And Regression Trees

CART : Classification And Regression Trees

Gönderim Mayıs 9th, 2014

matlabMatlab’ta CART : Classification And Regression Trees islemlerinin nasil kullanildigi hakkinda basit bir kac uygulamayi makale iceriginde bulabilirsiniz. Ayni zamanda CART : Classification And Regression Trees islemlerinde datasetlerin nasil cagirilabilecegi hakkinda da bilgi sahibi olabileceksiniz.

Uygulama 1 : Breast Cancer Wisconsin (Original) Data Set kullanilarak classification ve regration tree olusturuluyor.

Matlab Kod

clear all;
close all;
clc;

dataset = load(‘breast-cancer-wisconsin.data’);
train = dataset(:,1:10);
class = dataset(:,11);

classificationTree = fitctree(train,class)
view(classificationTree)
view(classificationTree,’mode’,’graph’)

regressionTree = fitrtree(train,class);
view(regressionTree)
view(regressionTree,’mode’,’graph’)

Uygulama 2 : Breast Cancer Wisconsin (Original) Data Set kullanilarak dogruluk, hata oranlari ve confusion matrix degerleri hesaplaniyor.

Matlab Kod

clear all;
close all;
clc;

dataset = load(‘breast-cancer-wisconsin.data’);
dataEgitim = dataset(1:600,1:10);
dataTest = dataset(601:683,1:10);
classEgitim = dataset(1:600,11);
classTest = dataset(601:683,11);

tree = ClassificationTree.fit(dataEgitim, classEgitim)
t = classregtree(dataEgitim, classEgitim);

cvv = crossval(tree);
error = kfoldLoss(cvv)
dogruluk = 1 – error

c1 = tree.predict(dataTest);
cMat = confusionmat(classTest, c1)

error =    0.0517
dogruluk =    0.9483
cMat =    67     2
0    14

Uygulama 3 :

Matlab Kod

clear all;
close all;
clc;

x1 = [0 1 0 1 0 1 0 1]’;
x2 = [0 0 0 0 1 1 1 1]’;
x3 = [0 0 1 1 0 0 1 1]’;
inData = [x1, x2, x3];
outData = [‘-‘, ‘-‘, ‘+’, ‘+’, ‘+’, ‘+’, ‘-‘, ‘-‘]’;

mytree = treefit(inData, outData, ‘method’, ‘classification’, ‘splitmin’, 2, ‘prune’, ‘on’, ‘splitcriterion’, ‘gdi’)
treedisp(mytree);

Decision tree for classification
1  if x1<0.5 then node 2 elseif x1>=0.5 then node 3 else –
2  if x2<0.5 then node 4 elseif x2>=0.5 then node 5 else –
3  if x2<0.5 then node 6 elseif x2>=0.5 then node 7 else –
4  if x3<0.5 then node 8 elseif x3>=0.5 then node 9 else –
5  if x3<0.5 then node 10 elseif x3>=0.5 then node 11 else –
6  if x3<0.5 then node 12 elseif x3>=0.5 then node 13 else –
7  if x3<0.5 then node 14 elseif x3>=0.5 then node 15 else –
8  class = –
9  class = +
10  class = +
11  class = –
12  class = –
13  class = +
14  class = +
15  class = –

Keyifli Calismalar Dilerim.

Etiketler: , , , , ,
Bulundugu Konu Etiketleri Akademik, Bilgisayarli Gorme / Goruntu Isleme, Matlab, Oruntu Tanima/ Pattern Recognition, Yazilim |

Lutfen Yorumlarinizi Burdan Ulastiriniz!...

You must be Kullanici Adiniz : to post a comment.

Istatistik

  • 1 Uye
  • 334 Yazi
  • 16 Yorum Var