29
Strojové učení Marta Vomlelová [email protected] KTIML, S303

Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Strojové učení

Marta Vomlelová

[email protected]

KTIML, S303

Page 2: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Literatura

1.T. Hastie, R. Tishirani, and J. Friedman. The Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další, web).

2.I.H.Witten and E.Frank. Data Mining - Practical machine learning tools and techniques with Java implementation. Accademic Press Pub., USA, 1999.

Page 3: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Doplňující literatura

P. Berka.Dobývání znalostí z databází. Academia, 2003.T. Mitchell. Machine Learning. McGraw Hill, New York, 1997.S. Russel and P. Norwig. Artificial Intelligence: A Modern Approach. Prentice Hall, 2003.

Page 4: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Příklady statistického učení

Vytořit z dat model, který dokáže:● Určit polohu robota z minulé pozice a senzorů .● U pacienta hospitalizovaného s infarktem

predikovat riziko dalšího infarktu. Predikci lze založit na demografických, stravovacích a klinických datech o pacientovi.

● Rozpoznání spamu od e-mailu.● Predikovat cenu akcií za 6 měsíců z aktuální

výkonnosti společnosti a ekonomických dat.

Page 5: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Typický scénář „zadání“● Máme danou cílovou veličinu

● kvantivativní Y – cena akcií, nebo● kategoriální G – infarkt ano/ne.

● Chceme její hodnotu predikovat na základě příznaků (features) X● klinická měření, stravování.

● Máme množinu trénovacích dat, u kterých známe i příznaky, i hodnotu cílové veličiny.

● Na základě těchto dat tvoříme model . ● Dobrý model predikuje cíl s malou chybou.

f , g

Page 6: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Učení s učitelem / bez učitele● Předchozí slajd se týká učení s učitelem

(supervized learning).

● Při učení bez učitele nemáme žádnou cílovou veličinu, úkolem je popsat data – např. klastrováním či určením závislostí. (unsupervised learning)

Page 7: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Příklad: Klasifikace e-mailu.● Data obsahují 4601 příkladů, snažíme se

rozlišit spam a žádaný e-mail.● Známe cílovou třídu spam/email a frekvence 57

nejčastějších slov či znaků.

● Příklad modelu:

● V tomto příkladu je nestejná cena chyby.

Page 8: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Příklad: rakovina prostaty● Cílem je predikovat logaritmus prostate specific

antigen (lpsa) z množiny příznaků.

● Predikujeme spojitouveličinu.

● Bodový graf, XY graf(scatter plot)

Page 9: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

ObsahChapter 2: Úvod do učení s učitelemChapter 3. a 4. Lineární metody pro regresi a klasifikaciChapter 5. SplajnyChapter 6. Jádrové (kernal) metody a lokální regrese

Chapter 7. Ohodnocení a volba modelůChapter 8. Kombinace modelů, EM algoritmus, ..Chapter 9: Rozhodovací stromyChapter 10: BoostingChapter 11: Neuronové sítě

Chapter 12: Support vector machinesChapter 13: Nejbližší sousedéChapter 14: Učení bez učitele

Page 10: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Typické otázky u zkoušky● Vysvětlete pojem:

přeučení, prokletí dimenzionality, bayesovsky optimální predikce, maximálně věrohodný odhad, optimální separující nadrovina, ...

● Napište algoritmus: AdaBoost, Rozhodovací stromy včetně prořezávání, EM, SVM, ...

● Dolňující otázky pro ujasnění, nakolik pojmům/algoritmům rozumíte

na jedničku či pokud jste někde hodně nevěděli.Mnohé ze slajdů se nezkouší, z přednášky možná vytušíte co ;-)

Page 11: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Přehled základních pojmů● vstupní veličiny (=features), cílová veličina● numerické, kategoriální, uspořádané veličiny● regrese (=predikce numerické veličiny)● klasifikace (=predikce kategoriální veličiny)● binární veličiny – kódujeme 0/1 nebo -1/1● uspořádané – často pomocí dummy variables (pomocné

proměnné)

● vstupní veličiny značíme X, výstup Y resp. G.● X je matice Nxp, predikce značíme střechou .

Page 12: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Lineární regresep

p

p

p

Page 13: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Lin. regrese 2

p

Page 14: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Lin. regrese - výsledek

● Není-li invertibilní, ubereme závislé sloupce, nebo se pokusíme překódovat nebo přefiltrovat data tak, aby invertibilní byla.

Page 15: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,
Page 16: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,
Page 17: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,
Page 18: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Maskování

U lineární regrese pro víc tříd může dojít k maskování:modrá třída není nikdy predikovaná.

Page 19: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,
Page 20: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,
Page 21: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,
Page 22: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,
Page 23: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Lin. regrese vs. nejbližší sousedé● Lineární regrese

● je hladká, stabilní● výrazně závisí na předpokladu linearity hranice● má malý rozptyl, potenciálně velké vychýlení (bias).

● k-NN● se přizpůsobí libovolné (spojité..) hranici● predikce záleží na pozici a hodnotách pár okolních

bodů, proto je nestabilní● velký rozptyl, malé vychýlení (bias).

Page 24: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Přeučení (overfitting)● Přeučením se nazývá

přílišná závislost modelu na trénovacích datech, která zvyšuje chybu na testovacích datech.Tj. růst oranžové křivky při klesající modré vpravo v grafu.

Page 25: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Optimální bayeskovská hranice● Pokud víme, jakým

procesem jsou data generována, můžeme v každém bodě predikovat nejčastější hodnotu (při stejné ceně chyby).

● Tento postup vytvoří optimální bayesovskou hranici (kde jsou obě hodnoty stejně časté).

Page 26: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Prokletí dimenzionality● Nejbližší sousedé jsou při velké dimenzi hodně

daleko.

Page 27: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Proč vadí vzdálený nejbližší soused

Page 28: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Druhý příklad

Page 29: Strojové učeníkti.mff.cuni.cz/~marta/uvod.pdfThe Elements of Statistical Learning, Data Mining, Inference and Prediction. Springer Series in Statistics. Springer, (2003 a další,

Weka● nástroj pro Data mining, umožňuje učit mnoho

modelů.

● http://www.cs.waikato.ac.nz/ml/weka/