2016-10-25 8 views
1

내 프로젝트의 일부로 PCA로 추출한 분류 된 내 기능에 대한 Matlab 함수 인 "fitctree"함수를 사용하고있는 의사 결정 트리를 사용해야합니다.의사 결정 트리 심도

피트 깊이을 제어하려고 함 fitctree 기능에서. 누구든지 어떻게 할 수 있는지 알고 있습니까? 예를 들어 나무 수를 200, 나무 깊이를 10으로 변경했습니다. 어떻게해야합니까? 의사 결정 트리에서이 값을 변경할 수 있습니까?

최고,

답변

0

ID3 알고리즘을 사용한다고 가정 해 보겠습니다. 그 pseudocode 트리의 깊이를 제어하는 ​​방법을 제공 할 수 있습니다.

ID3 (Examples, Target_Attribute, Attributes, **Depth**) 
// Check the depth of the tree, if it is 0, we are going to break 
if (Depth == 0) { break; } 

// Else continue 
Create a root node for the tree 
If all examples are positive, Return the single-node tree Root, with label = +. 
If all examples are negative, Return the single-node tree Root, with label = -. 
If number of predicting attributes is empty, then Return the single node tree Root, 
with label = most common value of the target attribute in the examples. 
Otherwise Begin 
    A ← The Attribute that best classifies examples. 
    Decision Tree attribute for Root = A. 
    For each possible value, vi, of A, 
     Add a new tree branch below Root, corresponding to the test A = vi. 
     Let Examples(vi) be the subset of examples that have the value vi for A 
     If Examples(vi) is empty 
      Then below this new branch add a leaf node with label = most common target value in the examples 

     // We decrease the value of Depth by 1 so the tree stops growing when it reaches the designated depth 
     Else below this new branch add the subtree ID3 (Examples(vi), Target_Attribute, Attributes – {A}, Depth - 1) 
End 
Return Root 

fictree 함수는 어떤 알고리즘을 구현하려고합니까? 당신은 그와 함께 플레이해야

  • MinLeafSize에게

    • MaxNumSplits
    • MinParentSize

    https://de.mathworks.com/help/stats/classification-trees-and-regression-trees.html#bsw6baj

    을 :

  • 0

    fitctree는 결과 트리의 깊이를 제어 할 경우에만 입력 매개 변수를 제공합니다 매개 변수는 트리의 깊이를 제어합니다. 의사 결정 트리는 순도에 도달하면 성장이 멈추기 때문에 그게 전부입니다.

    또 다른 가능성은 가지 치기를 켜는 것입니다. 가지 치기는 인스턴스를 분류하는 데 거의 힘을주지 않는 트리 섹션을 제거하여 트리 크기를 줄입니다.

    +0

    내가 원하는 깊이의 나무를 어떻게 만들 수 있습니까? 예를 들어, 난 단지 3 깊이가있는 의사 결정 트리를 만들고 싶습니다. –