Syntax highlighting of Archiv/Dobývání znalostí

{{Předmět|Dobývání znalostí|Doc. RNDr. Mrázová Iveta, CSc.|NDBI023}}

== Požadavky 12/13 ==
* výsledná známka = 40% body ze zkoušky, 20% body z dvou písemek, 40% body z úkolů ze cvičení a projektu (včetně bodů ze cvičení, všechny úkoly jsou povinné)
* vypracovat projekt
* celkem je potreba splnit aspon 56%
* terminy v září budou jeden až dva

== Zdroje k předmětu ==
* [http://ksvi.mff.cuni.cz/~mraz/datamining/index.html Stránky předmětu] 
* [[NDBI023 Shrnutí|Shrnutí na zkoušku]]

* [[Wikipedia:Datamining]]
* [http://home.okstate.edu/homepages.nsf/toc/onlinetutorialsstatistics Statistics Tutorials]
* [http://www.graphpad.com/www/book/choose.htm How to choose a statistical test]
* [http://www.autonlab.org/tutorials/ Statistical Data Mining Tutorials]
* [http://matlabdatamining.blogspot.cz/ Data mining in Matlab]

=== Fisherův test ===
* http://en.wikipedia.org/wiki/Fisher%27s_exact_test#Example - odvození, příklad jednostranného
* http://oldweb.izip.cz/ds3/hypertext/JZAAA.htm - příklad česky
* http://www.quantpsy.org/fisher/fisher.htm - hezké vysvětlení jednostranných a oboustranných testů, kalkulačka
* http://graphpad.com/quickcalcs/contingency2/ - ještě jedna kalkulačka pro kontrolu :)
* http://www.stahroun.me.cz/interstat/kategorialni/asociace/fisher/index.htm - spousta zdrojů

=== chi-kvadrát test ===
* http://mathhelpforum.com/advanced-statistics/44800-two-tailed-chi-squared-tests.html - trošku světla na oboustranné testy
* http://stats.stackexchange.com/questions/22347/chi-squared-always-a-one-sided-test - a jeste jednou oboustranné testy
* http://itl.nist.gov/div898/handbook/eda/section3/eda3674.htm - tabulky

== Písemky ==

[[NDBI023_Písemky]]

== Příklady ze cvičení ==
=== Algoritmus TDIDT/ID3 ===
* http://ksvi.mff.cuni.cz/~mraz/datamining/Cvicenie_DT.pdf

Zvol jeden atribut jako kořen podstromu

==== Kořen ====

===== Vitamín =====
* B (2+, 3-)

<math>-\frac{n_+(Vit(B))}{n(Vit(B))}.log_2\frac {n_+(Vit(B))}{n(Vit(B))} - \frac{n_-(Vit(B))}{n(Vit(B))}.log_2\frac {n_-(Vit(B))}{n(Vit(B))} = - \frac{2}{5}.log_2\frac {2}{5} - \frac{3}{5}.log_2\frac {3}{5} = 0.97</math>

* C (4+, 0-)

<math>\dots = 0.0</math> (z "definície"...)

* D (3+, 2-)

<math>\dots = 0.97</math>

Entropia: <math>H(Vit) = \frac{0.971*5 + 0*4 + 0.971*5}{14} = 0.6936</math> (vážený priemer)

===== Velikost rodiny =====

* veľká (2+, 2-)
<math>-\frac{n_+(Rodina(velka))}{m(Rodina(velka))}.log_2\frac {n_+(Rodina(velka))}{n(Rodina(velka))} - \frac{n_-(Rodina(velka))}{n(Rodina(velka))}.log_2\frac {n_-(Rodina(velka))}{n(Rodina(velka))} = 1</math>

* stredná (4+, 2-)
<math>\dots = 0.9183</math>

* malá (3+, 1-)
<math>\dots = 0.8113</math>

Entropia: <math>H(Rodina)=0.9111</math>


===== Cvičil =====
* pravidelně (3+, 4-)
<math>\dots = - \frac{3}{7}.log_2\frac {3}{7} - \frac{4}{7}.log_2\frac {4}{7} = 0.985</math>

* málo (6+, 1-)
<math>\dots = - \frac{6}{7}.log_2\frac {6}{7} - \frac{1}{7}.log_2\frac {1}{7} = 0.592</math>

Entropia: <math>H(Cvicil) = \frac{0.985*7 + 0.592*7}{14} = 0.7885</math>

===== Bypass =====

Entropia: <math>H(Bypass)=0.8922</math>



... budeme teda pokračovať podľa atribútu Vitamín (najmenšia entropia).

Množinu rozdelíme na 3 skupiny (B,C,D). C-čko všetci prežili, máme dve skupiny pre Bcomplex a D - spočítame znovu strednú entropiu (aby sme vedeli, podľa čoho ďalej štiepiť).


==== B ====
vyberieme riadky s Bcomplex a robíme to isté :)

===== Velikost rodiny =====
* veľká (0, 2-)
<math>\dots = 0</math> (z "definice"...)

* stredná (1+, 1-)
<math>\dots = 1</math>

* malá (1+, 0)
<math>\dots = 0</math> (z "definice"...)

Entropia: <math>H(Rodina) = \frac{0*2 + 1*2 + 0*1}{5} = 0.4</math>

===== Cvicil =====
<math>H(Cvicil)=0</math>
===== Bypass =====
<math>H(Bypass)=0.9183</math>

==== C ====
...je jasné, tam nik nezomrel... :)

==== D ====

<math>H(Rodina)=0.9183</math>
<math>H(Cvicil)=0.9183</math>
<math>H(Bypass)=0</math>


...ďalej sa teda bude štiepiť v Bčku podľa "Cvicil" a v Dčku podľa "Bypass"

<pre>
            Vitamin
             / | \
           B/ C|  \D
     Cviceni   +   Bypass
prav./  m.|        a|  n\
  -       +         -    +
</pre>

=== Perceptron ===
* uloha: naucit perceptron rozoznavat body v 2D na 2 skupiny...

* popis perceptronu v matlabe: <math>p=[ \begin{matrix} w_1 & w_2 & prah \end{matrix} ]</math>
** vyhodnoti sa potom... <math>x=[\begin{matrix} x_1 & x_2 \end{matrix} ]</math> => <math>perc_{recall} = w_1*x_1 + w_2*x_2 + prah*1</math>
** ...rozsireny vstupny vektor <math>x_1'=[\begin{matrix} x_1 & x_2 & 1 \end{matrix} ]</math>
** <math>vystup=hardlim1(p*x_1')</math> (hardlim1(<=0)=0; hardlim1(>0)=1)

* inicializacia : <math>p=[ \begin{matrix} 1 1 1 \end{matrix} ]</math>
* vstup: <math>A=\left[ \begin{matrix} 1 & 1 & 2 & 3 \\ 1 & 3 & 2 & 1 \end{matrix} \right]</math>
* vystup (chceme): <math> c = [ \begin{matrix} 1 & 1 & 0 & 0 \end{matrix} ] </math>

* uciaca konstanta <math>a=0.2</math>
* ucenie prebieha takto:
** vezme sa vzor, ak sedi, nic nerobime
** ak najdeme chybu - pricitame/odcitame (pozadovany-skutocny vystup - napr. v priklade <math>y=hardlim1(p*AA); dif=c(3)-y(3)</math>) dany vektor  k vaham... <math>(c(3)-y(3))*AA(:,3)</math>
*** dostavam novy perceptron <math>p1=p+a*((c(3)-y(3))*AA(:,3))'</math>
** <math>y1=hardlim1(p1*AA) = [ \begin{matrix} 1 & 1 & 1 & 1 \end{matrix} ]</math>
*** to je zla matica (ma byt samozrejme [1 1 0 0])- znovu zopakujeme postup...
****<math> p1=[ \begin{matrix} 0.6 & 0.6 & -0.2 \end{matrix} ] => y1=[ \begin{matrix} 1 & 1 & 1 & 1 \end{matrix} ]</math>
****<math> p2=[ \begin{matrix} 0 & 0.4 & -0.4 \end{matrix} ] => y2=[ \begin{matrix} 0 & 1 & 1 & 0 \end{matrix} ]</math>
*****teraz budeme skusat prvy vektor (ktory je nespravny)
****<math> p3=[ \begin{matrix} 0.2 & 0.6 & -0.2 \end{matrix} ] => y2=[ \begin{matrix} 1 & 1 & 1 & 1 \end{matrix} ]</math>
***** ... N iteracii (N=?)

[[Category:Informatika]]