To jest stara wersja strony!


Drzewa decyzyjne

Drzewo decyzyjne to graficzna metoda wspomagania procesu decyzyjnego, stosowana w teorii decyzji. Algorytm drzew decyzyjnych jest również stosowany w uczeniu maszynowym do pozyskiwania wiedzy na podstawie przykładów.

Przykład drzewa decyzyjnego

Przykładowe drzewo decyzyjne dla danych z zestawu poniżej:

@relation weather.symbolic

@attribute outlook {sunny, overcast, rainy}
@attribute temperature {hot, mild, cool}
@attribute humidity {high, normal}
@attribute windy {TRUE, FALSE}
@attribute play {yes, no}

@data
sunny,hot,high,FALSE,no
sunny,hot,high,TRUE,no
overcast,hot,high,FALSE,yes
rainy,mild,high,FALSE,yes
rainy,cool,normal,FALSE,yes
rainy,cool,normal,TRUE,no
overcast,cool,normal,TRUE,yes
sunny,mild,high,FALSE,no
sunny,cool,normal,FALSE,yes
rainy,mild,normal,FALSE,yes
sunny,mild,normal,TRUE,yes
overcast,mild,high,TRUE,yes
overcast,hot,normal,FALSE,yes
rainy,mild,high,TRUE,no

Drzewo decyzyjne

Algorytm ID3

Algorytm ID3 służący do budowania drzew decyzyjnych bazuja na dwóch parametrach, które można wyliczyć bezpośrednio ze zbioru uczącego:

  • Entropii - będącej miarą zróżnicowania danych
  • Przyrostu wiedzy (Information Gain) - miara różnicy Entropii przed i po rozbiciu zbioru danych $S$ przy pomocy atrybutu $A$

Entropia

$$H(S) = - \sum_{x \in X} p(x) \log_{2} p(x) $$

Gdzie

  • $S$ - Aktualny zbiór danych dla którego liczona jest entropia (dla każdego węzła drzewa będzie to inny - odpowiednio mniejszy zbiór danych)
  • $X$ - zbiór klas w zbiorze $S$
  • $p(x)$ - Stosunek liczby elementów z klasy $x$ do liczby elementów w zbiorze $S$

Przyrost wiedzy (Information Gain)

$$G(A) = H(S) - \sum_{t \in T} p(t)H(t) $$

Gdzie,

  • $H(S)$ - Entropia dla zbioru $S$
  • $T$ - Podzbiór powstały z rozbicia zbioru $S$ przez atrybut $A$, w taki sposób, że $S = \bigcup_{t \in T} t$
  • $p(t)$ - Stosunek ilości elementów w $t$ do ilości elementów w $S$
  • $H(t)$ - Entropia podzbioru $t$

Algorytm ID3

ID3 (Examples, Target_Attribute, Attributes)
    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 (highest Information Gain).
        Decision Tree attribute for Root = A.
        For each possible value, v_i, of A,
            Add a new tree branch below Root, corresponding to the test A = v_i.
            Let Examples(v_i) be the subset of examples that have the value v_i for A
            If Examples(v_i) is empty
                Then below this new branch add a leaf node with label = most common target value in the examples
            Else below this new branch add the subtree ID3 (Examples(v_i), Target_Attribute, Attributes – {A})
    End
    Return Root
  1. Zasady budowania drzewa - algorytm ID3
  2. Policz entropię i informaiton gain - wyznacz korzeń drzewa.

Wprowadzenie do Weki

  1. Wprowadzenie do weki:
    1. Histotgramy
    2. Nieprzydatne cechy
  2. J48
    1. Zbudowanie drzewa do przykladu z zajec i do innych
    2. User clasifier
    3. ZeroR
pl/dydaktyka/ml/2014lab3.1395052237.txt.gz · ostatnio zmienione: 2019/06/27 15:54 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0