├── .gitignore ├── 01_Seminar Paper ├── content │ ├── appendix.tex │ ├── bibliography.bib │ ├── conclusion.tex │ ├── decisiontree.png │ ├── faulogo-eps-converted-to.pdf │ ├── faulogo.eps │ ├── introduction.tex │ ├── mainpart.tex │ ├── sampleDecisiontree.py │ └── theme.tex ├── seminarpaper.pdf └── seminarpaper.tex ├── 02_Praesentation ├── Matlab │ ├── DT.m │ ├── View.fig │ ├── View.m │ ├── accelerationLevel.mat │ ├── cell2csv.m │ ├── loadingModel.m │ ├── motionType.mat │ ├── overfitting.m │ ├── peaks.avi │ ├── plotTree.m │ └── tree.mat ├── praesentation.pdf ├── praesentation.tex ├── src │ ├── actual.tikz │ ├── actualSample.tikz │ ├── akw.jpg │ ├── baumsilhouette.png │ ├── baumsilhouettewinter.png │ ├── bestTree.tikz │ ├── blackboard-01.eps │ ├── blackboard-eps-converted-to.pdf │ ├── blackboard.eps │ ├── filteredAccelerationLevel.tikz │ ├── fruechte │ │ ├── apfel.png │ │ ├── banane.png │ │ ├── grapefruit.png │ │ ├── kirsche.png │ │ ├── orange.png │ │ ├── traube.png │ │ ├── wassermelone.png │ │ └── zitrone.png │ ├── fullTree.tikz │ ├── goodfitting.tikz │ ├── goodfittingSample.tikz │ ├── logo.png │ ├── logo_.png │ ├── lollibunt.png │ ├── lollischwarz.png │ ├── nfmoving.tikz │ ├── overfitting.tikz │ ├── overfittingSample.tikz │ ├── perfTree.tikz │ ├── underfitting.tikz │ └── underfittingSample.tikz └── theme.tex ├── 03_Python Code ├── fishiris.csv ├── implementation.py └── tbc.csv ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | bin/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | eggs/ 16 | lib/ 17 | lib64/ 18 | parts/ 19 | sdist/ 20 | var/ 21 | *.egg-info/ 22 | .installed.cfg 23 | *.egg 24 | 25 | # Installer logs 26 | pip-log.txt 27 | pip-delete-this-directory.txt 28 | 29 | # Unit test / coverage reports 30 | htmlcov/ 31 | .tox/ 32 | .coverage 33 | .cache 34 | nosetests.xml 35 | coverage.xml 36 | 37 | # Translations 38 | *.mo 39 | 40 | # Mr Developer 41 | .mr.developer.cfg 42 | .project 43 | .pydevproject 44 | 45 | # Rope 46 | .ropeproject 47 | 48 | # Django stuff: 49 | *.log 50 | *.pot 51 | 52 | # Sphinx documentation 53 | docs/_build/ 54 | 55 | .texpadtmp/ 56 | .DS\_Store 57 | .DS_Store 58 | 04_BibliographyRakefile 59 | -------------------------------------------------------------------------------- /01_Seminar Paper/content/appendix.tex: -------------------------------------------------------------------------------- 1 | 2 | \setcounter{section}{0} 3 | \renewcommand{\thesection}{\Alph{section}} 4 | 5 | \section*{Bibliography} 6 | \addcontentsline{toc}{section}{Bibliography} 7 | \printbibliography[heading=none] 8 | 9 | 10 | %\section{Appendix} 11 | 12 | 13 | % Blibliography 14 | 15 | %\setcounter{chapter}{0}% 16 | %\setcounter{section}{0}% 17 | %\renewcommand{\thesubsection}{\Alph{subsection}} 18 | 19 | \section*{Bibliography} 20 | \addcontentsline{toc}{section}{Bibliography} 21 | \printbibliography[heading=none] 22 | 23 | %\renewcommand*\listfigurename{List of Figures} 24 | \listoffigures 25 | \listoftables 26 | \lstlistoflistings 27 | %\addcontentsline{toc}{subsection}{\listfigurename} 28 | 29 | 30 | 31 | %\subsection{List of Figures} 32 | %\renewcommand*\listfigurename{} 33 | %\listoffigures 34 | 35 | %\addcontentsline{toc}{subsection}{\listtablename} 36 | %\listoftables 37 | %\addcontentsline{toc}{subsection}{\listlistingname} 38 | %\lstlistoflistings 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /01_Seminar Paper/content/bibliography.bib: -------------------------------------------------------------------------------- 1 | %% This BibTeX bibliography file was created using BibDesk. 2 | %% http://bibdesk.sourceforge.net/ 3 | 4 | 5 | %% Created for Michael Dorner at 2014-01-02 13:25:56 +0100 6 | 7 | 8 | %% Saved with string encoding Unicode (UTF-8) 9 | 10 | @article{quinlan1987simplifying, 11 | title={Simplifying decision trees}, 12 | author={Quinlan, J. Ross}, 13 | journal={International journal of man-machine studies}, 14 | volume={27}, 15 | number={3}, 16 | pages={221--234}, 17 | year={1987}, 18 | publisher={Elsevier} 19 | } 20 | 21 | @book{quinlan1993c4, 22 | title={C4.5: Programs for Machine Learning}, 23 | author={Quinlan, J. Ross}, 24 | series={C4.5 - programs for machine learning / J. Ross Quinlan}, 25 | year={1993}, 26 | publisher={Morgan Kaufmann Publishers} 27 | } 28 | 29 | @article{quinlan1986induction, 30 | title={Induction of decision trees}, 31 | author={Quinlan, J. Ross}, 32 | journal={Machine learning}, 33 | volume={1}, 34 | number={1}, 35 | pages={81--106}, 36 | year={1986}, 37 | publisher={Springer} 38 | } 39 | 40 | @article{tong2003decision, 41 | title={Decision forest: combining the predictions of multiple independent decision tree models}, 42 | author={Tong, Weida and Hong, Huixiao and Fang, Hong and Xie, Qian and Perkins, Roger}, 43 | journal={Journal of Chemical Information and Computer Sciences}, 44 | volume={43}, 45 | number={2}, 46 | pages={525--531}, 47 | year={2003}, 48 | publisher={ACS Publications} 49 | } 50 | 51 | @article{zhang2005missing, 52 | title={" Missing is useful": missing values in cost-sensitive decision trees}, 53 | author={Zhang, Shichao and Qin, Zhenxing and Ling, Charles X and Sheng, Shengli}, 54 | journal={Knowledge and Data Engineering, IEEE Transactions on}, 55 | volume={17}, 56 | number={12}, 57 | pages={1689--1693}, 58 | year={2005}, 59 | publisher={IEEE} 60 | } 61 | 62 | 63 | @article{curram1994neural, 64 | title={Neural networks, decision tree induction and discriminant analysis: An empirical comparison}, 65 | author={Curram, Stephen P. and Mingers, John}, 66 | journal={Journal of the Operational Research Society}, 67 | volume={45}, 68 | number={4}, 69 | pages={440--450}, 70 | year={1994} 71 | } 72 | 73 | @inproceedings{huang2003comparing, 74 | title={Comparing naive Bayes, decision trees, and SVM with AUC and accuracy}, 75 | author={Huang, Jin and Lu, Jingjing and Ling, Charles X.}, 76 | booktitle={Data Mining, 2003. ICDM 2003. Third IEEE International Conference on}, 77 | pages={553--556}, 78 | year={2003}, 79 | organization={IEEE} 80 | } 81 | 82 | @article{safavian1991survey, 83 | title={A survey of decision tree classifier methodology}, 84 | author={Safavian, S. Rasoul and Landgrebe, David}, 85 | journal={IEEE transactions on systems, man, and cybernetics}, 86 | volume={21}, 87 | number={3}, 88 | pages={660--674}, 89 | year={1991} 90 | } 91 | 92 | @article{banfield2007comparison, 93 | title={A comparison of decision tree ensemble creation techniques}, 94 | author={Banfield, Robert E. and Hall, Lawrence O. and Bowyer, Kevin W. and Kegelmeyer, W. Philip}, 95 | journal={Pattern Analysis and Machine Intelligence, IEEE Transactions on}, 96 | volume={29}, 97 | number={1}, 98 | pages={173--180}, 99 | year={2007}, 100 | publisher={IEEE} 101 | } 102 | 103 | 104 | @article{lavanya2011performance, 105 | title={Performance Evaluation of Decision Tree Classifiers on Medical Datasets}, 106 | author={Lavanya, D. and Rani, K. Usha}, 107 | journal={International Journal of Computer Applications}, 108 | volume={26}, 109 | year={2011} 110 | } 111 | 112 | @article{buhrman2002complexity, 113 | title={Complexity measures and decision tree complexity: a survey}, 114 | author={Buhrman, Harry and De Wolf, Ronald}, 115 | journal={Theoretical Computer Science}, 116 | volume={288}, 117 | number={1}, 118 | pages={21--43}, 119 | year={2002}, 120 | publisher={Elsevier} 121 | } 122 | 123 | @inproceedings{su2006fast, 124 | title={A fast decision tree learning algorithm}, 125 | author={Su, Jiang and Zhang, Harry}, 126 | booktitle={Proceedings of the National Conference on Artificial Intelligence}, 127 | volume={21}, 128 | number={1}, 129 | pages={500}, 130 | year={2006}, 131 | organization={AAAI Press; MIT Press; 1999} 132 | } 133 | 134 | @book{duda2012pattern, 135 | title={Pattern classification}, 136 | author={Duda, Richard O. and Hart, Peter E. and Stork, David G.}, 137 | year={2012}, 138 | publisher={John Wiley \& Sons} 139 | } 140 | 141 | @article{morgan1963problems, 142 | title={Problems in the analysis of survey data, and a proposal}, 143 | author={Morgan, James N. and Sonquist, John A.}, 144 | journal={Journal of the American statistical association}, 145 | volume={58}, 146 | number={302}, 147 | pages={415--434}, 148 | year={1963}, 149 | publisher={Taylor \& Francis Group} 150 | } 151 | 152 | @INPROCEEDINGS{Kohavi99decisiontree, 153 | author = {Ron Kohavi and Quinlan, J. Ross}, 154 | title = {Decision Tree Discovery}, 155 | booktitle = {Handbook of Data Mining and Knowledge Discovery}, 156 | year = {1999}, 157 | pages = {267--276}, 158 | publisher = {University Press} 159 | } 160 | 161 | @article{lagacherie1997addressing, 162 | title={Addressing geographical data errors in a classification tree for soil unit prediction}, 163 | author={Lagacherie, Philippe and Holmes, Susan}, 164 | journal={International Journal of Geographical Information Science}, 165 | volume={11}, 166 | number={2}, 167 | pages={183--198}, 168 | year={1997}, 169 | publisher={Taylor \& Francis} 170 | } 171 | 172 | @article{wu2006effective, 173 | title={An effective application of decision tree to stock trading}, 174 | author={Wu, Muh-Cherng and Lin, Sheng-Yu and Lin, Chia-Hsin}, 175 | journal={Expert Systems with Applications}, 176 | volume={31}, 177 | number={2}, 178 | pages={270--274}, 179 | year={2006}, 180 | publisher={Elsevier} 181 | } 182 | 183 | @article{blurock1995automatic, 184 | title={Automatic learning of chemical concepts: Research octane number and molecular substructures}, 185 | author={Blurock, Edward S.}, 186 | journal={Computers \& chemistry}, 187 | volume={19}, 188 | number={2}, 189 | pages={91--99}, 190 | year={1995}, 191 | publisher={Elsevier} 192 | } 193 | 194 | 195 | @article{vlahou2003diagnosis, 196 | title={Diagnosis of ovarian cancer using decision tree classification of mass spectral data}, 197 | author={Vlahou, Antonia and Schorge, John O. and Gregory, Betsy W. and Coleman, Robert L.}, 198 | journal={BioMed Research International}, 199 | volume={2003}, 200 | number={5}, 201 | pages={308--314}, 202 | year={2003}, 203 | publisher={Hindawi Publishing Corporation} 204 | } 205 | 206 | 207 | @article{salzberg1995decision, 208 | title={Decision trees for automated identification of cosmic-ray hits in Hubble Space Telescope images}, 209 | author={Salzberg, Steven and Chandar, Rupali and Ford, Holland and Murthy, Sreerama K. and White, Richard}, 210 | journal={Publications of the Astronomical Society of the Pacific}, 211 | pages={279--288}, 212 | year={1995}, 213 | publisher={JSTOR} 214 | } 215 | 216 | @article{mingers1989empirical, 217 | title={An empirical comparison of selection measures for decision-tree induction}, 218 | author={Mingers, John}, 219 | journal={Machine learning}, 220 | volume={3}, 221 | number={4}, 222 | pages={319--342}, 223 | year={1989}, 224 | publisher={Springer} 225 | } 226 | 227 | @article{buntine1992further, 228 | title={A further comparison of splitting rules for decision-tree induction}, 229 | author={Buntine, Wray and Niblett, Tim}, 230 | journal={Machine Learning}, 231 | volume={8}, 232 | number={1}, 233 | pages={75--85}, 234 | year={1992}, 235 | publisher={Springer} 236 | } 237 | 238 | 239 | @article{shih1999families, 240 | title={Families of splitting criteria for classification trees}, 241 | author={Shih, Yu-Shan}, 242 | journal={Statistics and Computing}, 243 | volume={9}, 244 | number={4}, 245 | pages={309--315}, 246 | year={1999}, 247 | publisher={Springer} 248 | } 249 | 250 | @inproceedings{drummond2000exploiting, 251 | title={Exploiting the cost (in) sensitivity of decision tree splitting criteria}, 252 | author={Drummond, Chris and Holte, Robert C.}, 253 | booktitle={ICML}, 254 | pages={239--246}, 255 | year={2000} 256 | } 257 | 258 | @article{breiman1996technical, 259 | title={Technical note: Some properties of splitting criteria}, 260 | author={Breiman, Leo}, 261 | journal={Machine Learning}, 262 | volume={24}, 263 | number={1}, 264 | pages={41--47}, 265 | year={1996}, 266 | publisher={Springer} 267 | } 268 | 269 | 270 | @book{rokach2008data, 271 | title={Data Mining with Decision Trees: Theory and Applications}, 272 | author={Rokach, L.}, 273 | series={Series in machine perception and artificial intelligence}, 274 | year={2008}, 275 | publisher={World Scientific Publishing Company, Incorporated} 276 | } 277 | 278 | 279 | @article{shannon2001mathematical, 280 | title={A mathematical theory of communication}, 281 | author={Shannon, Claude Elwood}, 282 | journal={The Bell System Technical Journal}, 283 | volume={27}, 284 | number={1}, 285 | pages={379 -- 423, 623 -- 656}, 286 | year={1948}, 287 | publisher={ACM} 288 | } 289 | 290 | @book{dos2012entropy, 291 | title={Entropy Guided Transformation Learning: Algorithms and Applications: Algorithms and Applications}, 292 | author={dos Santos, C.N. and Milidi{\'u}, R.L.}, 293 | series={SpringerBriefs in Computer Science}, 294 | year={2012}, 295 | publisher={Springer} 296 | } 297 | 298 | 299 | @book{rob2008database, 300 | title={Database Systems: Design, Implementation \& Management}, 301 | author={Rob, P. and Coronel, C. and Crockett, K.}, 302 | year={2008}, 303 | publisher={Cengage Learning} 304 | } 305 | 306 | 307 | @article{goldman2010self, 308 | title={Self-Pruning Prediction Trees}, 309 | author={Goldman, Sally and Singer, Yoram}, 310 | journal={WiML}, 311 | url={http://snowbird.djvuzone.org/2010/abstracts/122.pdf}, 312 | year={2013} 313 | } 314 | 315 | @article{kass1980exploratory, 316 | title={An exploratory technique for investigating large quantities of categorical data}, 317 | author={Kass, Gordon V.}, 318 | journal={Applied statistics}, 319 | pages={119--127}, 320 | year={1980}, 321 | publisher={JSTOR} 322 | } 323 | 324 | @article{messenger1972modal, 325 | title={A modal search technique for predictive nominal scale multivariate analysis}, 326 | author={Messenger, Robert and Mandell, Lewis}, 327 | journal={Journal of the American statistical association}, 328 | volume={67}, 329 | number={340}, 330 | pages={768--772}, 331 | year={1972}, 332 | publisher={Taylor \& Francis Group} 333 | } 334 | 335 | @book{cormen2001introduction, 336 | title={Introduction to algorithms}, 337 | author={Cormen, Thomas H. and Leiserson, Charles E. and Rivest, Ronald L. and Stein, Clifford and others}, 338 | volume={2}, 339 | year={2001}, 340 | publisher={MIT Press} 341 | } 342 | -------------------------------------------------------------------------------- /01_Seminar Paper/content/conclusion.tex: -------------------------------------------------------------------------------- 1 | 2 | \newpage 3 | 4 | 5 | \section{Summary \& Conclusion} 6 | 7 | \subsection{Applications} 8 | 9 | Decision trees have a wide field of applications. In this subsection some examples of the applications are listed. 10 | 11 | \begin{description} 12 | \item[Astronomy] \cite{salzberg1995decision} applied decision tree learning to the task of distinguishing between stars and cosmic rays in images collected by the Hubble Space Telescope. 13 | %\item[Library] In [26], decision trees are developed that predict the future use of books in a library. 14 | \item[Chemistry] The relationship between the research on octane (ROC) number and the molecular substructures were explored in the paper \cite{blurock1995automatic}. 15 | \item[Medicine] In \cite{vlahou2003diagnosis} decision trees are applied for the diagnosis of the ovarian cancer. 16 | \item[Economy] The results of the research project on decision trees used in stock trading was published in \cite{wu2006effective}. 17 | \item[Geography] \cite{lagacherie1997addressing} used classification trees to predict and correct errors in topographical and geological data. 18 | \end{description} 19 | 20 | 21 | 22 | \subsection{Programming Example} 23 | 24 | In the programming example a decision tree induction algorithm was implemented in the programming language Python. The focus during the development was on readability and understanding, less on performance and software architecture. 25 | 26 | Two splitting criterions are implemented: Information and Gini gain (ID3 and CART). Also a basic pruning algorithm can be used, which uses a threshold for the pruning decision (see subsection \ref{stoppingcriterionimpl} for the idea of stopping criterion). The decision tree itself is implemented as binary tree and does not support regression analysis. 27 | 28 | Two examples are enclosed: Tuberculosis/pneumonia and fish iris classification. Both are from real world, while the first example consists of only a handful instances due to the fact that this example was calculated completely by hand in the presentation. The second example origins from Matlab demo files. 29 | 30 | The code is well commented and has a demo application for each example. 31 | 32 | 33 | 34 | \subsection{Summary} 35 | 36 | In the scope of this paper, a small introduction to decision trees was given. The introductory example showed the working principle and advantages of decision trees. An overview of machine learning approaches helped to see the bigger picture. 37 | 38 | The theory part started with some necessary definitions which are used in the following parts. The basic top-down induction of decision trees algorithm was introduced and the options for improving this framework were described mathematically. 39 | 40 | Four decision tree algorithms were selected and presented to the reader: CHAID, ID3, CART, and C4.5. All facts from the previous sections were compared and traded off one against the other. Due to the limited scope of this seminar paper some parts were not considered in detail, but a small outlook on these interesting topics is given. 41 | 42 | The last part shows some examples where decision trees find their application in the real world and how many-faceted this field is. The programming example with a small code documentation completes the picture of decision trees. 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /01_Seminar Paper/content/decisiontree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/01_Seminar Paper/content/decisiontree.png -------------------------------------------------------------------------------- /01_Seminar Paper/content/faulogo-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/01_Seminar Paper/content/faulogo-eps-converted-to.pdf -------------------------------------------------------------------------------- /01_Seminar Paper/content/faulogo.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/01_Seminar Paper/content/faulogo.eps -------------------------------------------------------------------------------- /01_Seminar Paper/content/introduction.tex: -------------------------------------------------------------------------------- 1 | \section{Introduction} 2 | 3 | 4 | \subsection{What is a decision tree?} \label{whatisadecisiontree} 5 | A business student with only a very few programming skills shall develop a simple algorithm for sorting three elements $A, B, C$. He decides to divide this problem in smaller subproblems. First he wonders if $A$ is smaller then $B$. In the second step it is interesting if $B$ is smaller then $C$. If $A> [-2, 0, 9] 87 | print( sort1(2,0,0) ) # >> [0, 0, 2] 88 | \end{lstlisting} 89 | 90 | \begin{remark} 91 | The Python if-statement syntax implies the tree structure in a vertical form, too. 92 | \end{remark} 93 | 94 | Another way of formatting if-clauses represents a rule set which are first order logical expressions: 95 | \begin{lstlisting}[style = fau, language = Python, caption={A Python reimplementation of the decision tree given in listing \ref{lst:sort1} as a set of first order logical rules},label=lst:sort2] 96 | def sort2(A, B, C): 97 | if (A < B) and (B < C) : return [A, B, C] 98 | if (A < B) and not (B < C) and (A < C): return [A, C, B] 99 | if (A < B) and not (B < C) and not (A < C): return [C, A, B] 100 | if not (A < B) and (B < C) and (A < C): return [B, A, C] 101 | if not (A < B) and (B < C) and not (A < C): return [B, C, A] 102 | if not (A < B) and not (B < C) : return [C, B, A] 103 | \end{lstlisting} 104 | 105 | Unsurprisingly, we get six rules for $3! = 6$ different combinations and the same results as in the algorithm \texttt{sort1}. 106 | 107 | 108 | This introductory example shows four important properties: Decision trees 109 | \begin{enumerate} 110 | \item work very well for classification and data mining. 111 | \item are intuitive and self-explanatory. 112 | \item are easy to implement. 113 | \item can be even used by business students. 114 | \end{enumerate} 115 | 116 | \begin{remark} 117 | Decision trees are used to model all comparison sorts like mergesort or quicksort. The reader may notice that the decision tree in figure \ref{fig:sortingtree} represents the insertion sort algorithm \cite[p. 208]{cormen2001introduction}. 118 | \end{remark} 119 | 120 | 121 | 122 | 123 | \subsection{Taxonomy}\label{taxonomy} 124 | 125 | Before we approach the theory behind decision trees, a small but general overview of the taxonomy shall be given. 126 | 127 | Decision tree classification is very often used in the context of data mining and machine learning. These keywords are no synonyms -- although used as one very often. Machine learning cannot be seen as a true subset of data mining, as it also contains other fields, not utilized for data mining (e.g. theory of learning, computational learning theory, and reinforcement learning). 128 | 129 | Figure \ref{fig:machinelearningcontext} shows the machine learning context for decision trees. 130 | 131 | \begin{figure}[!h] \centering 132 | \begin{tikzpicture}[ 133 | edge from parent path={(\tikzparentnode\tikzparentanchor) -- (\tikzchildnode.north)}, 134 | every node/.style={text centered, draw=none, anchor=north, draw=none, fill=white, minimum height=1.5em}, 135 | %level distance=1.5cm, 136 | level 1/.style={sibling distance=5cm, level distance=1cm}, 137 | level 2/.style={sibling distance=3.5cm, level distance=2cm}] 138 | \node (Root) {Machine Learning Algorithms} 139 | child { 140 | node [draw, dashed, text width=7em] {Unsupervised Learning} 141 | child[grow=south west] {node {\dots}} 142 | } 143 | child { 144 | node [draw, dashed, text width=13em] { 145 | \begin{tikzpicture}[level 2/.style={sibling distance=2.7cm, level distance=0.75cm}] 146 | \node[text width=12em, text=faublue] {Supervised Learning } 147 | child [] { 148 | node [text width=6em, text=faublue] {Classification} 149 | edge from parent[draw, solid] 150 | } 151 | child { 152 | node[text width=5em] {Regression} 153 | edge from parent[draw, solid] 154 | }; 155 | \end{tikzpicture} 156 | } % end node 157 | child[] { 158 | node[text=faublue] {Decision Tree} 159 | } 160 | child[] { 161 | node[text width=7em] {Artificial Neural Network} 162 | } 163 | child[] { 164 | node[text width=7em] {Support Vector Machines} 165 | } 166 | child[] { 167 | node {\dots} 168 | } 169 | } 170 | child { 171 | node[draw, dashed, text width=7em] {Reinforcement Learning} 172 | child[grow=south east] {node {\dots}} 173 | } 174 | ; 175 | \end{tikzpicture} 176 | \caption[The context of decision trees in machine learning with topics visited in this paper.]{The context of decision trees in machine learning with \textcolor{faublue}{topics visited in this paper}.} 177 | \label{fig:machinelearningcontext} 178 | \end{figure} 179 | 180 | \begin{remark} 181 | The context shown in figure \ref{fig:machinelearningcontext} is not intended for being complete, e.g. there is mixture of unsupervised and supervised learning, so called semi-supervised learning. Also not every decision tree can handle continuous values for regression analysis as we will see later. 182 | \end{remark} 183 | 184 | Decision trees have a sibling, called regression trees. They have a common parent: prediction trees \cite{goldman2010self}. The basic idea is to use trees to model functions though each end point will result in the same predicted value, a constant for that point. Thus a regression tree is like a classification tree except that the end point will be a predicted function value rather than a predicted classification. 185 | 186 | 187 | %\begin{figure}[!h] \centering 188 | %\begin{tikzpicture}[edge from parent/.style={draw, open triangle 60-}, 189 | %level distance=1.5cm, 190 | %level 1/.style={sibling distance=1cm}, 191 | %level 2/.style={sibling distance=4cm}] 192 | %\tikzstyle{every node}=[rectangle,draw] 193 | %\node (Root) {Tree} 194 | %child { 195 | % node {Prediction Tree} 196 | % child{ node{Classification Tree} } 197 | % child{ node{Regression Tree} } 198 | %}; 199 | %\end{tikzpicture} 200 | %\caption{An UML-like pedigree of classification and regression trees. } 201 | %\label{fig:predictiontree} 202 | %\end{figure} 203 | 204 | Although, there is a wide field of applications for regression trees, the focus of this paper in only on classification trees. 205 | 206 | 207 | 208 | \subsection{About this paper} 209 | 210 | This project work emerges in the context of the course \textit{Artificial Intelligence} in the winter semester 2013/2014. Beside this seminar paper, an introductory presentation was conducted and an implementation for decision tree was developed. 211 | 212 | In the scope of this seminar paper, a small introduction to theory and application of decision trees shall be given. 213 | 214 | After this short introduction a theoretical consideration shall guide to a practical part, which shall clarify the theoretical part by examples. The last part shall summarize and compare the introduced algorithm and shall give a small outlook to not tackled research fields of decision trees. 215 | 216 | On the contrary to the presentation during the seminar, this seminar paper expects a basic knowledge about graph theory, complexity, and machine learning from the reader. Instead of an introduction to these underlying topics, a deeper look inside four decision tree algorithm families shall be given: \textsc{CHAID}, \textsc{CART}, \textsc{ID3}, and \textsc{C4.5}. 217 | 218 | The focus of the introduced Python implementation is on classification. This limitation is not owed to the insufficient importance of regression calculating, but a wider look would push the boundaries of this seminar paper. 219 | 220 | \begin{remark} 221 | Remark boxes like this one shall help to see the bigger pictures. It contains information that will not be explained any further, but which are a starting point for further investigations. 222 | \end{remark} 223 | 224 | 225 | 226 | 227 | \newpage 228 | -------------------------------------------------------------------------------- /01_Seminar Paper/content/mainpart.tex: -------------------------------------------------------------------------------- 1 | 2 | \section{Theory of Decision Trees} 3 | 4 | In this section a (computer) scientific base for the informal introduction of decision trees shall be given. As mentioned in the introduction a basic knowledge in graph theory, machine learning and computer science in general is assumed. 5 | 6 | 7 | \subsection{Definitions} 8 | 9 | \begin{definition} 10 | A \textbf{tree} is a directed, connected graph with one root node. Every other node has a single predecessor (\textbf{parent}) and no or more successors (\textbf{children}). Nodes without successors are called \textbf{leaves}. All nodes are connected by \textbf{edges}. The \textbf{depth} of a node is the number of edges on the path to the root. The \textbf{height} of the whole tree is the number of edges on the longest path from the root to any leaf. 11 | \end{definition} 12 | 13 | \begin{remark} 14 | This very rough definition focussed on trees shall not hide the fact that graph theory is complex and enormous mathematical field. For a deeper look e.g. \cite{cormen2001introduction} is recommended. 15 | \end{remark} 16 | 17 | \begin{definition} 18 | A \textbf{decision tree} is a tree with following equivalents: 19 | \begin{center} 20 | \begin{tabular}{l|l} 21 | \textbf{Tree} & \textbf{Decision tree equivalent} \\ \hline 22 | Root & Initial decision node \\ 23 | Node & Internal decision node for testing on an attribute \\ 24 | Edge & Rule to follow \\ 25 | Leaf & Terminal node represents the resulting classification 26 | \end{tabular} 27 | \end{center} 28 | \end{definition} 29 | 30 | As mentioned in subsection \ref{taxonomy}, machine learning is a set of algorithms that extract models representing patterns from data and then evaluate those models. Let us define four relevant terms, which are important for understanding the following algorithms descriptions: instance, attribute, class, and dataset: 31 | 32 | \begin{definition} 33 | The input of a machine learning algorithm consists of a set of \textbf{instances} (e.g. rows, examples or observations). Each instance is described by a fixed number of \textbf{attributes} (i.e. columns), which are assumed to be either nominal or numeric, and a label which is called \textbf{class} (in case of a classification task). The set of all instances is called \textbf{dataset}. 34 | \end{definition} 35 | 36 | Following this definition we get a table containing the dataset: Each decision becomes an attribute (all binary relations), all leaves are classes, while each row represents an instance of the dataset (see table \ref{tab:decisiontable}). 37 | 38 | \begin{table}[!h] \centering 39 | \begin{tabular}{|l| l l l |l|} \hline 40 | \textbf{Instance} & \multicolumn{3}{c|}{\textbf{Attribute}} & \multicolumn{1}{c|}{\textbf{Class}}\\ 41 | & $A= 0.0; 226 | testAccelerationLevel = restAccelerationLevel(:, secondSelection); 227 | testMotionType = restMotionType(:, secondSelection); 228 | 229 | verificationAccelerationLevel = restAccelerationLevel(:, ~secondSelection); 230 | verificationMotionType = restMotionType(:, ~secondSelection); 231 | end 232 | 233 | 234 | -------------------------------------------------------------------------------- /02_Praesentation/Matlab/motionType.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/Matlab/motionType.mat -------------------------------------------------------------------------------- /02_Praesentation/Matlab/overfitting.m: -------------------------------------------------------------------------------- 1 | close all; 2 | 3 | N = 20; 4 | %R = randn(N,1)+2; R(end) = R(1); 5 | x = linspace(0,2,N).'; 6 | y = (x-1).^3 + 1; 7 | data = y+0.5*randn(N,1)+(-1).^(randn(N,1)>0.5)*0.1 ; 8 | 9 | d = data > y; 10 | y1 = data(d); 11 | y2 = data(~d); 12 | x1 = x(d); 13 | x2 = x(~d); 14 | 15 | p1 = polyfit(x,data,1); 16 | p2 = polyfit(x,data,3); 17 | p3 = polyfit(x,data,19); 18 | 19 | baseURL = '/Users/michaeldorner/Dropbox/Entscheidungsbaeume/Praesentation/src/'; 20 | 21 | figure(1), plot(x, y, 'g--', x1, y1, 'b+', x2, y2, 'bo' ); 22 | set(gca, 'XTickLabelMode', 'manual', 'XTickLabel', []); 23 | set(gca, 'YTickLabelMode', 'manual', 'YTickLabel', []); 24 | xlabel('$x$'); 25 | ylabel('$y$'); 26 | 27 | name = 'actualSample'; 28 | matlab2tikz([baseURL name '.tikz'], 'height', '\figureheight', 'width', '\figurewidth'); 29 | 30 | 31 | 32 | figure(2), plot(x, y, 'g--', x1, y1, 'b+', x2, y2, 'bo', x, polyval(p1,x), 'r-'); 33 | 34 | set(gca, 'XTickLabelMode', 'manual', 'XTickLabel', []); 35 | set(gca, 'YTickLabelMode', 'manual', 'YTickLabel', []); 36 | xlabel('$x$'); 37 | ylabel('$y$'); 38 | 39 | name = 'underfittingSample'; 40 | matlab2tikz([baseURL name '.tikz'], 'height', '\figureheight', 'width', '\figurewidth') 41 | 42 | 43 | figure(3), plot(x, y, 'g--', x1, y1, 'b+', x2, y2, 'bo', x, polyval(p2,x),'r-'); 44 | 45 | set(gca, 'XTickLabelMode', 'manual', 'XTickLabel', []); 46 | set(gca, 'YTickLabelMode', 'manual', 'YTickLabel', []); 47 | xlabel('$x$'); 48 | ylabel('$y$'); 49 | 50 | name = 'goodfittingSample'; 51 | matlab2tikz([baseURL name '.tikz'], 'height', '\figureheight', 'width', '\figurewidth') 52 | 53 | 54 | figure(4), plot(x, y, 'g--', x1, y1, 'b+', x2, y2, 'bo', x, polyval(p3,x),'r-'); 55 | 56 | %legend('actual splitting line', 'class 1', 'class 2', 'found splitting line', 'Location', 'northwest'); 57 | set(gca, 'XTickLabelMode', 'manual', 'XTickLabel', []); 58 | set(gca, 'YTickLabelMode', 'manual', 'YTickLabel', []); 59 | xlabel('$x$'); 60 | ylabel('$y$'); 61 | 62 | name = 'overfittingSample'; 63 | matlab2tikz([baseURL name '.tikz'], 'height', '\figureheight', 'width', '\figurewidth') 64 | 65 | 66 | -------------------------------------------------------------------------------- /02_Praesentation/Matlab/peaks.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/Matlab/peaks.avi -------------------------------------------------------------------------------- /02_Praesentation/Matlab/plotTree.m: -------------------------------------------------------------------------------- 1 | function plotTree(varargin) 2 | tree = varargin{1}; 3 | %load tree; 4 | p = tree.Parent'; 5 | c = tree.Children'; 6 | 7 | [x,y,h] = treelayout(p); 8 | 9 | f = find(p~=0); 10 | pp = p(f); 11 | %X = [x(f); x(pp); NaN(size(f))]; 12 | %Y = [y(f); y(pp); NaN(size(f))]; 13 | X = [x(f); x(pp)]; 14 | Y = [y(f); y(pp)]; 15 | 16 | figure, plot (x, y, 'ro', X, Y, 'r-'); 17 | axis off; 18 | if nargin > 1 19 | name = varargin{2}; 20 | % settings 21 | baseURL = '/Users/michaeldorner/Dropbox/Entscheidungsbaeume/Praesentation/src/'; 22 | matlab2tikz([baseURL name '.tikz'], 'height', '\figureheight', 'width', '\figurewidth') 23 | h 24 | end 25 | end 26 | 27 | 28 | -------------------------------------------------------------------------------- /02_Praesentation/Matlab/tree.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/Matlab/tree.mat -------------------------------------------------------------------------------- /02_Praesentation/praesentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/praesentation.pdf -------------------------------------------------------------------------------- /02_Praesentation/praesentation.tex: -------------------------------------------------------------------------------- 1 | 2 | \include{theme} 3 | 4 | 5 | \title[Softcomputing] 6 | {Entscheidungsbäume -- Eine Einführung} 7 | 8 | \subtitle 9 | {} 10 | 11 | \author[] 12 | {Michael~Dorner} 13 | 14 | \institute[Softcomputing] % (optional, but mostly needed) 15 | {Softcomputing} 16 | 17 | 18 | \date[] 19 | {Erlangen, 16. Januar 2014} 20 | 21 | \subject{Seminar Künstliche Intelligenz} 22 | 23 | % \insertshortauthor, \insertshortinstitute, \insertshorttitle, \insertshortdate, ... 24 | %\renewcommand{\footlinetext}{\insertshortinstitute, \insertshorttitle, \insertshortdate} 25 | 26 | \AtBeginSubsection[] 27 | { 28 | \begin{frame}{Übersicht} 29 | \begin{multicols}{2} 30 | \tableofcontents[currentsection,currentsubsection] 31 | \end{multicols} 32 | \end{frame} 33 | } 34 | 35 | 36 | \begin{document} 37 | 38 | %\renewcommand{\thealgorithm}{} 39 | 40 | 41 | \begin{frame}[plain] 42 | \titlepage 43 | \end{frame} 44 | 45 | \begin{frame}{Übersicht} 46 | \begin{multicols}{2} 47 | \tableofcontents 48 | \end{multicols} 49 | \end{frame} 50 | 51 | 52 | \section{Entscheidungsbäume} 53 | 54 | \begin{frame}{Einfach} 55 | 56 | \nicequote{Albert Einstein}{Everything should be made as simple as possible, but not simpler.} 57 | 58 | \end{frame} 59 | 60 | 61 | 62 | 63 | 64 | \subsection{Definition} 65 | 66 | \begin{frame}{Definition} 67 | \subtitle{uuuuu} 68 | \textbf{Was ist ein Entscheidungsbaum?} \\[2em] 69 | \begin{Definition} 70 | 71 | \begin{itemize}[<+->] 72 | \item Ein Entscheidungsbaum ist ein Baum mit folgenden Eigenschaften: 73 | \begin{itemize}[<+->] 74 | \item ein innerer Knoten repräsentiert ein \textcolor{ohmred}{Attribut} 75 | \item eine Kante repräsentiert einen Test auf dem Attribut des Vaterknotens 76 | \item ein Blatt repräsentiert eine der \textcolor{ohmgreen}{Klassen} 77 | \end{itemize} 78 | \item Konstruktion eines Entscheidungsbaums 79 | \begin{itemize}[<+->] 80 | %\item Greedy Search 81 | \item anhand der Trainingsmenge 82 | \item Top-Down 83 | \end{itemize} 84 | \item Anwendung eines Entscheidungsbaums 85 | \begin{itemize}[<+->] 86 | \item Durchlaufen des Entscheidungsbaum von der Wurzel zu einem der Blätter (somit eindeutiger Pfad) 87 | \item Zuordnung des Objekts zur Klasse des erreichten Blattes 88 | \end{itemize} 89 | \end{itemize} 90 | 91 | \end{Definition} 92 | 93 | \end{frame} 94 | 95 | 96 | \subsubsection{Beispielentscheidungsbaum} 97 | 98 | \begin{frame}{Beispiel (1)} 99 | 100 | \textbf{Folge ich dem Vortrag aufmerksam?}\\[2em] 101 | 102 | 103 | \begin{center} 104 | \begin{tikzpicture}[level distance=1.5cm, 105 | level 1/.style={sibling distance=7cm}, 106 | level 2/.style={sibling distance=2cm}] 107 | \tikzstyle{every node}=[rectangle,draw] 108 | \node (Root) [ohmred] {Vortragsthema} 109 | child [visible on=<2->] { 110 | node [ohmred, visible on=<4->] {Mathematiklastig} 111 | child [visible on=<5->]{ 112 | node [ohmgreen] {nein} 113 | edge from parent node[left,draw=none] {ja} 114 | } 115 | child [visible on=<6->]{ 116 | node [ohmred, visible on=<7->] {Beginn} 117 | child [visible on=<8->]{ 118 | node [ohmgreen] {nein} 119 | edge from parent node[left,draw=none] {Einsteinzitat} 120 | } 121 | child [visible on=<9->]{ 122 | node [ohmgreen] {ja} 123 | edge from parent node[right,draw=none] {lustiges Katzenbild} 124 | } 125 | edge from parent node[right,draw=none] {nein} 126 | } 127 | edge from parent node[left,draw=none] {interessant $\;$} 128 | } 129 | child [visible on=<3->] { 130 | node [ohmred, visible on=<10->] {Vortragender} 131 | child [visible on=<11->]{ 132 | node [ohmgreen, visible on=<13->] {ja} 133 | edge from parent node[left,draw=none] {attraktive Frau} 134 | } 135 | child [visible on=<12->]{ 136 | node [ohmgreen, visible on=<14->] {nein} 137 | edge from parent node[right,draw=none] {unattraktiver Mann} 138 | } 139 | edge from parent node[right,draw=none] { $\;$ uninteressant} 140 | }; 141 | \end{tikzpicture} 142 | \end{center} 143 | 144 | \end{frame} 145 | 146 | 147 | \begin{frame}{Beispiel (2)} 148 | 149 | \textbf{Wie sieht der Entscheidungsbaum als Tabelle aus?} \\[2em] 150 | \centering 151 | \begin{tabular}{| l l l l | l |} \hline 152 | \textbf{\textcolor{ohmred}{Vortragsthema}} & \textbf{\textcolor{ohmred}{Mathematiklastig}} & \textbf{\textcolor{ohmred}{Vortragender}} & \textbf{\textcolor{ohmred}{Beginn}} & \textbf{\textcolor{ohmgreen}{Aufmerksam?}} \\ \hline 153 | interessant & nein & Frau & Katzenbild & ja \\ 154 | uninteressant & ja & Frau & Definition & ja \\ 155 | uninteressant & ja & Mann & Definition & nein \\ 156 | uninteressant & nein & Mann & Definition & nein \\ 157 | interessant & nein & Mann & Katzenbild & ja \\ 158 | interessant & ja & Mann & Definition & nein \\ \hline 159 | \end{tabular} 160 | 161 | \end{frame} 162 | 163 | \subsection{Konstruktion} 164 | \begin{frame}{Konstruktion} 165 | 166 | \textbf{Wie konstruiere ich Entscheidungsbäume generisch?}\\[2em] 167 | 168 | 169 | 170 | \begin{algorithm}[H] 171 | \caption{Konstruktion von Entscheidungsbäumen} 172 | \begin{enumerate}[<+->] 173 | \item Wähle ein (bestes) Attribut 174 | \item Erstelle Knoten für dieses Attribut 175 | \item Füge für jeden Attributwert eine Verzweigung zu dem neuen Knoten 176 | \item Partitioniere die Trainingsdaten entsprechend der Attributwerte 177 | \item Wiederhole \textcolor{ohmblue}{1.} -- \textcolor{ohmblue}{4.}, bis alle Daten im neuen Knoten der gleichen Klasse angehören 178 | \end{enumerate} 179 | \end{algorithm} 180 | 181 | \end{frame} 182 | 183 | 184 | \subsubsection{Beispielkonstruktion} 185 | \begin{frame}{Beispielkonstruktion eines Entscheidungsbaums (1)} 186 | 187 | \textbf{Möchte ich jetzt schlafen?} \\[2em] 188 | 189 | \pause 190 | 191 | \begin{columns}[c] 192 | \begin{column}{0.5\linewidth} 193 | \begin{tabular}{| l l | l |}\hline 194 | \textbf{\textcolor{ohmred}{Müde}} & \textbf{\textcolor{ohmred}{Bett}} & \textbf{\textcolor{ohmgreen}{Schlafen?}} \\ \hline 195 | nein & nein & nein \\ 196 | nein & ja & nein \\ 197 | ja & nein & nein \\ 198 | ja & ja & ja \\ \hline 199 | \end{tabular} 200 | \end{column} \pause 201 | \begin{column}{0.5\linewidth} 202 | \begin{tikzpicture}[level distance=1.5cm, 203 | level 1/.style={sibling distance=2cm}, 204 | level 2/.style={sibling distance=1cm}] 205 | \tikzstyle{every node}=[rectangle,draw] 206 | \node (Root) [visible on=<1->, ohmred] {Müde} 207 | child [visible on=<2->] { 208 | node [visible on=<4->, ohmred] {Bett} 209 | child [visible on=<5->] { 210 | node [visible on=<6->, ohmgreen] {ja} 211 | edge from parent node[left,draw=none] {ja} 212 | } 213 | child [visible on=<5->] { 214 | node [visible on=<7->, ohmgreen] {nein} 215 | edge from parent node[right,draw=none] {nein} 216 | } 217 | edge from parent node[left,draw=none] {ja} 218 | } 219 | child [visible on=<2->] { 220 | node [visible on=<3->, ohmgreen] {nein} 221 | edge from parent node[right,draw=none] {nein} 222 | }; 223 | \end{tikzpicture} 224 | \end{column} 225 | \end{columns} 226 | 227 | 228 | 229 | \end{frame} 230 | 231 | 232 | 233 | 234 | \begin{frame}{Beispielkonstruktion eines Entscheidungsbaums (2)} 235 | 236 | \textbf{Gibt es einen weiteren/besseren Entscheidungsbaum?} \\[2em] 237 | 238 | \pause 239 | 240 | Ja, offensichtlich, denn \\[1em] 241 | 242 | \begin{columns}[b] 243 | \column[]{0.45\textwidth} \centering 244 | \begin{tikzpicture}[level distance=1.5cm, 245 | level 1/.style={sibling distance=2cm}, 246 | level 2/.style={sibling distance=1cm}] 247 | \tikzstyle{every node}=[rectangle,draw] 248 | \node (Root) [ohmred] {Bett} 249 | child { 250 | node [ohmred] {Müde} 251 | child { 252 | node [ohmgreen] {ja} 253 | edge from parent node[left,draw=none] {ja} 254 | } 255 | child { 256 | node [ohmgreen] {nein} 257 | edge from parent node[right,draw=none] {nein} 258 | } 259 | edge from parent node[left,draw=none] {ja} 260 | } 261 | child { 262 | node [ohmgreen] {nein} 263 | edge from parent node[right,draw=none] {nein} 264 | }; 265 | \end{tikzpicture} 266 | 267 | \column[]{0.45\textwidth} \centering 268 | \begin{tikzpicture}[level distance=1.5cm, 269 | level 1/.style={sibling distance=2cm}, 270 | level 2/.style={sibling distance=1cm}] 271 | \tikzstyle{every node}=[rectangle,draw] 272 | \node (Root) [ohmred] {Müde} 273 | child { 274 | node [ohmred] {Bett} 275 | child { 276 | node [ohmgreen] {ja} 277 | edge from parent node[left,draw=none] {ja} 278 | } 279 | child { 280 | node [ohmgreen] {nein} 281 | edge from parent node[right,draw=none] {nein} 282 | } 283 | edge from parent node[left,draw=none] {ja} 284 | } 285 | child { 286 | node [ohmgreen] {nein} 287 | edge from parent node[right,draw=none] {nein} 288 | }; 289 | \end{tikzpicture} 290 | \end{columns} 291 | 292 | \vfill 293 | 294 | \pause 295 | 296 | \begin{center} 297 | Welches ist das beste Attribut? 298 | \end{center} 299 | 300 | \end{frame} 301 | 302 | 303 | 304 | 305 | 306 | \section{ID3 Algorithmus} 307 | 308 | \subsection{Exkurs in die Physik} 309 | 310 | 311 | \begin{frame}{Exkurs in die Physik} 312 | 313 | \textbf{Warum haben Atomkraftwerke Kühltürme?}\\[2em] 314 | \centering 315 | \includegraphics[height=0.8\textheight]{src/akw.jpg} 316 | 317 | \end{frame} 318 | 319 | 320 | 321 | \begin{frame}{Blick zur Tafel} 322 | 323 | \centering 324 | 325 | \includegraphics[width=\linewidth]{src/blackboard} 326 | 327 | \end{frame} 328 | 329 | 330 | 331 | \subsection{Informationsgehalt und -gewinn} 332 | 333 | \begin{frame}{Informationsgehalt \& Informationsgewinn} 334 | \begin{Definition} 335 | 336 | Den mittleren Informationsgehalt $H(P)$ einer Wahrscheinlichkeitsverteilung $P$ über einer endlichen Menge $S$ bezeichnet man als Entropie von $P$: 337 | \begin{equation*} 338 | H(S) = - \sum_{i=1}^{} P(C_i) \log_2 P(C_i) 339 | \end{equation*} 340 | mit $P(C_i)$ als Auftrittswahrscheinlichkeit der Klasse $C_i$ in $S$. 341 | 342 | \end{Definition} 343 | 344 | \pause 345 | 346 | \begin{Definition} 347 | Um den Informationsgewinn (\textit{Information Gain}) von Attribut $A$ zu quantifizieren, bilden wir die Differenz der ursprünglichen Information und der Restinformation: 348 | \begin{equation*} 349 | G(S, A) = H(S) - \sum_{i \in \text{Werte}(A)} \frac{|S_i|}{|S|}H(S_i) 350 | \end{equation*} 351 | mit \begin{itemize} 352 | \item $\text{Werte}(A)$ als alle Ausprägungen von $A$ und 353 | \item $S_i$ als Teilmenge von $S$, wobei $A$ den Wert $i$ annimmt. 354 | \end{itemize} 355 | 356 | \end{Definition} 357 | 358 | 359 | \end{frame} 360 | 361 | \subsubsection{Beispiel} 362 | 363 | 364 | \begin{frame}{Beispiel (1)} 365 | 366 | \textbf{Welchen Informationsgehalt (Entropie) haben folgende Nachrichten?}\\[1em] 367 | 368 | \begin{itemize}[<+->] 369 | \item \texttt{'aaaa'}: 370 | \begin{itemize} 371 | \item Wahrscheinlichkeitsverteilung: 372 | \[P(\texttt{'a'}) = \frac{4}{4}\] 373 | \item Entropie: 374 | \[H(\texttt{'aaaa'}) = - \left( \frac{4}{4} \log_2 \frac{4}{4} \right) = 0 \] 375 | \end{itemize} 376 | \item \texttt{'aabc'}: 377 | \begin{itemize}[<+->] 378 | \item Wahrscheinlichkeitsverteilungen: 379 | \[P(\texttt{'a'}) = \frac{2}{4}, \qquad P(\texttt{'b'}) = P(\texttt{'c'}) = \frac{1}{4}\] 380 | \item Entropie: 381 | \[H(\texttt{'aabc'}) = - \left( \frac{2}{4} \log_2 \frac{2}{4} + \frac{1}{4} \log_2 \frac{1}{4} + \frac{1}{4} \log_2 \frac{1}{4} \right) = 1.5 \] 382 | \end{itemize} 383 | \end{itemize} 384 | 385 | \end{frame} 386 | 387 | 388 | 389 | \begin{frame}{Beispiele (2)} 390 | 391 | \begin{itemize}[<+->] 392 | \item \texttt{'abcd'}: 393 | \begin{itemize}[<+->] 394 | \item Wahrscheinlichkeitsverteilungen: 395 | \[P(\texttt{'a'}) = P(\texttt{'b'}) = P(\texttt{'c'}) = P(\texttt{'d'}) = \frac{1}{4}\] 396 | \item Entropie: 397 | \[H(\texttt{'abcd'}) = - \left( \frac{1}{4} \log_2 \frac{1}{4} + \frac{1}{4} \log_2 \frac{1}{4} + \frac{1}{4} \log_2 \frac{1}{4} + \frac{1}{4} \log_2 \frac{1}{4} \right) = 2 \] 398 | \end{itemize} 399 | \item \texttt{'aaaabcdefg'}: 400 | \begin{itemize}[<+->] 401 | \item Wahrscheinlichkeitsverteilungen: 402 | \[P(\texttt{'a'}) = \frac{4}{10}, \quad P(\texttt{'b'}) = P(\texttt{'c'}) = P(\texttt{'d'}) = P(\texttt{'e'}) = P(\texttt{'f'}) = P(\texttt{'g'}) = \frac{1}{10}\] 403 | \item Entropie: 404 | \[H(\texttt{'aaaabcdefg'}) = - \left( \frac{4}{10} \log_2 \frac{4}{10} + 6 \cdot \left( \frac{1}{10} \log_2 \frac{1}{10} \right) \right) = 2{,}52193 \] 405 | \end{itemize} 406 | \end{itemize} 407 | \end{frame} 408 | 409 | 410 | 411 | \subsection{Pseudocode} 412 | \begin{frame}{Pseudocode} 413 | \begin{algorithm}[H] 414 | \caption{ID3 Algorithmus} 415 | \begin{enumerate} 416 | \item Wähle \sout{\textcolor{gray}{ein (bestes) Attribut}} das Attribut mit größtem Informationgewinn 417 | \item Erstelle Knoten für dieses Attribut 418 | \item Füge für jeden Attributwert eine Verzweigung zu dem neuen Knoten 419 | \item Partitioniere die Trainingsdaten entsprechend der Attributwerte 420 | \item Wiederhole \textcolor{ohmblue}{1.} -- \textcolor{ohmblue}{4.}, bis alle Daten im neuen Knoten der gleichen Klasse angehören 421 | \end{enumerate} 422 | \end{algorithm} 423 | \end{frame} 424 | 425 | \subsubsection{Beispiel} 426 | 427 | 428 | 429 | \begin{frame}{Beispiel} 430 | \textbf{Informationsgehalt von Krankheit}\\[1em] 431 | 432 | \begin{tabular}{|l l l l l l | l |}\hline 433 | \textbf{Patient} & \textbf{\textcolor{ohmred}{Fieber}} & \textbf{\textcolor{ohmred}{Husten}} & \textbf{\textcolor{ohmred}{Röntgen}} & \textbf{\textcolor{ohmred}{BSG}} & \textbf{\textcolor{ohmred}{Abhören}} &\textbf{\textcolor{ohmgreen}{Krankheit}}\\ \hline 434 | 1 & hoch & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 435 | 2 & mittel & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 436 | 3 & niedrig & leicht & Punkt & normal & fiepend & Lungenentzündung \\ 437 | 4 & hoch & mittel & Flocken & normal & blubbernd & Lungenentzündung \\ 438 | 5 & mittel & leicht & Flocken & normal & blubbernd & Lungenentzündung \\ 439 | 6 & ohne & leicht & Streifen & normal & normal & Tuberkulose \\ 440 | 7 & hoch & stark & Loch & schnell & fiepend & Tuberkulose \\ 441 | 8 & niedrig & leicht & Streifen & normal & normal & Tuberkulose \\ 442 | 9 & ohne & leicht & Punkt & schnell & fiepend & Tuberkulose \\ 443 | 10 & niedrig & mittel & Flocken & schnell & normal & Tuberkulose \\ \hline 444 | \end{tabular} 445 | 446 | \vfill 447 | 448 | \pause 449 | 450 | \[H(S) = - \sum_{i=1}^{} P(C_i) \log_2 P(C_i) = - \nicefrac{5}{10} \log_2 \nicefrac{5}{10} - \nicefrac{5}{10} \log_2 \nicefrac{5}{10} = 1\] 451 | 452 | \end{frame} 453 | 454 | 455 | 456 | \begin{frame}{Beispiel} 457 | 458 | \textbf{Informationsgehalt für Fieber}\\[1em] 459 | 460 | \begin{tabular}{|l l l l l l | l |}\hline 461 | \textbf{Patient} & \textbf{\textcolor{ohmred}{Fieber}} & \textbf{\textcolor{ohmred}{Husten}} & \textbf{\textcolor{ohmred}{Röntgen}} & \textbf{\textcolor{ohmred}{BSG}} & \textbf{\textcolor{ohmred}{Abhören}} &\textbf{\textcolor{ohmgreen}{Krankheit}}\\ \hline 462 | 1 & hoch & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 463 | 2 & mittel & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 464 | 3 & niedrig & leicht & Punkt & normal & fiepend & Lungenentzündung \\ 465 | 4 & hoch & mittel & Flocken & normal & blubbernd & Lungenentzündung \\ 466 | 5 & mittel & leicht & Flocken & normal & blubbernd & Lungenentzündung \\ 467 | 6 & ohne & leicht & Streifen & normal & normal & Tuberkulose \\ 468 | 7 & hoch & stark & Loch & schnell & fiepend & Tuberkulose \\ 469 | 8 & niedrig & leicht & Streifen & normal & normal & Tuberkulose \\ 470 | 9 & ohne & leicht & Punkt & schnell & fiepend & Tuberkulose \\ 471 | 10 & niedrig & mittel & Flocken & schnell & normal & Tuberkulose \\ \hline 472 | \end{tabular} 473 | 474 | \vfill 475 | 476 | \begin{tabular}{| l<{\onslide<2->} | l<{\onslide<3->} | l<{\onslide<5->} | l<{\onslide<6->} | l<{\onslide<7->} | l<{\onslide} |}\hline 477 | \textbf{\textcolor{ohmred}{Fieber}} & \textbf{Anzahl} & \textbf{LE} & \textbf{TBC} & \textbf{Formel} & \textbf{Ergebnis} \\ \hline 478 | hoch & 3 & $ \nicefrac{2}{3}$ & $ \nicefrac{1}{3}$ & $ \nicefrac{3}{10} \cdot \left(- \nicefrac{2}{3} \log_2 \nicefrac{2}{3} - \nicefrac{1}{3} \log_2 \nicefrac{1}{3} \right)$ & $=0{,}2755$\\ \hline 479 | mittel & 2 & $ \nicefrac{2}{2}$ & $\nicefrac{0}{2}$ & $ \nicefrac{2}{10} \cdot \left(- \nicefrac{2}{2} \log_2 \nicefrac{2}{2} - \nicefrac{0}{2} \log_2 \nicefrac{0}{2} \right)$ & $=0$\\ \hline 480 | niedrig & 3 & $\nicefrac{1}{3}$ & $\nicefrac{2}{3}$ & $\nicefrac{3}{10} \cdot \left(- \nicefrac{1}{3} \log_2 \nicefrac{1}{3} - \nicefrac{2}{3} \log_2 \nicefrac{2}{3} \right)$ & $=0{,}2755$\\ \hline 481 | ohne & 2 & $\nicefrac{0}{2}$ & $\nicefrac{2}{2}$ & $\nicefrac{2}{10} \cdot \left(- \nicefrac{0}{2} \log_2 \nicefrac{0}{2} - \nicefrac{2}{2} \log_2 \nicefrac{2}{2} \right)$ & $=0$\\ \hline 482 | \multicolumn{5}{r|}{$\boldsymbol{\sum}$} & \onslide<8->{$0{,}5510$} \\ \cline{6-6} 483 | \end{tabular} 484 | 485 | 486 | \end{frame} 487 | 488 | 489 | 490 | 491 | \begin{frame}{Beispiel} 492 | 493 | \textbf{Informationsgewinn für Fieber} 494 | 495 | \[ \displaystyle 496 | \begin{array}{r l l l} 497 | G(S, \text{Fieber}) &= H(S) &- \sum\limits_{\substack{i \in \{\text{hoch, mittel,} \\ \text{niedrig, ohne}\}}} \cfrac{|S_i|}{|S|}H(S_i) &= \pause \\[2em] 498 | &= 1 &-0{,}5510 &= 0{,}4490 499 | \end{array} 500 | \] 501 | 502 | \end{frame} 503 | 504 | 505 | 506 | \begin{frame}{Beispiel} 507 | 508 | \textbf{Informationsgehalt für Husten} \\[1em] 509 | 510 | \begin{tabular}{|l l l l l l | l |}\hline 511 | \textbf{Patient} & \textbf{\textcolor{ohmred}{Fieber}} & \textbf{\textcolor{ohmred}{Husten}} & \textbf{\textcolor{ohmred}{Röntgen}} & \textbf{\textcolor{ohmred}{BSG}} & \textbf{\textcolor{ohmred}{Abhören}} &\textbf{\textcolor{ohmgreen}{Krankheit}}\\ \hline 512 | 1 & hoch & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 513 | 2 & mittel & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 514 | 3 & niedrig & leicht & Punkt & normal & fiepend & Lungenentzündung \\ 515 | 4 & hoch & mittel & Flocken & normal & blubbernd & Lungenentzündung \\ 516 | 5 & mittel & leicht & Flocken & normal & blubbernd & Lungenentzündung \\ 517 | 6 & ohne & leicht & Streifen & normal & normal & Tuberkulose \\ 518 | 7 & hoch & stark & Loch & schnell & fiepend & Tuberkulose \\ 519 | 8 & niedrig & leicht & Streifen & normal & normal & Tuberkulose \\ 520 | 9 & ohne & leicht & Punkt & schnell & fiepend & Tuberkulose \\ 521 | 10 & niedrig & mittel & Flocken & schnell & normal & Tuberkulose \\ \hline 522 | \end{tabular} 523 | 524 | \vfill 525 | 526 | \begin{tabular}{| l<{\onslide<2->} | l<{\onslide<3->} | l<{\onslide<5->} | l<{\onslide<6->} | l<{\onslide<7->} | l<{\onslide} |}\hline 527 | \textbf{\textcolor{ohmred}{Husten}} & \textbf{Anzahl} & \textbf{LE} & \textbf{TBC} & \textbf{Formel} & \textbf{Ergebnis} \\ \hline 528 | stark & 3 & $ \nicefrac{2}{3}$ & $ \nicefrac{1}{3}$ & $ \nicefrac{3}{10} \cdot \left(- \nicefrac{2}{3} \log_2 \nicefrac{2}{3} - \nicefrac{1}{3} \log_2 \nicefrac{1}{3} \right)$ & $=0{,}2755$ \\ \hline 529 | mittel & 2 & $ \nicefrac{1}{2}$ & $\nicefrac{1}{2}$ & $ \nicefrac{2}{10} \cdot \left(- \nicefrac{1}{2} \log_2 \nicefrac{1}{2} - \nicefrac{1}{2} \log_2 \nicefrac{1}{2} \right)$ & $=0{,}2$ \\ \hline 530 | leicht & 5 & $\nicefrac{2}{5}$ & $\nicefrac{4}{5}$ & $\nicefrac{3}{10} \cdot \left(- \nicefrac{2}{5} \log_2 \nicefrac{2}{5} - \nicefrac{3}{5} \log_2 \nicefrac{3}{5} \right)$ & $=0{,}4855$ \\ \hline 531 | \multicolumn{5}{r|}{$\boldsymbol{\sum}$} & \onslide<8->{$0{,}9610$} \\ \cline{6-6} 532 | \end{tabular} 533 | 534 | \end{frame} 535 | 536 | 537 | \begin{frame}{Beispiel} 538 | 539 | \textbf{Informationsgewinn für Husten} 540 | 541 | \[ 542 | \begin{array}{r l l l} 543 | G(S, \text{Husten}) &= H(S) &- \sum\limits_{\substack{i \in \{\text{stark, } \\ \text{mittel,leicht}\}}} \cfrac{|S_i|}{|S|}H(S_i) &= \pause \\[1em] 544 | &= 1 &-0{,}9610 &= 0{,}0390 545 | \end{array} 546 | \] 547 | 548 | \end{frame} 549 | 550 | 551 | 552 | 553 | 554 | \begin{frame}{Beispiel} 555 | 556 | \textbf{Informationsgehalt für Abhören} \\[1em] 557 | 558 | \begin{tabular}{|l l l l l l | l |}\hline 559 | \textbf{Patient} & \textbf{\textcolor{ohmred}{Fieber}} & \textbf{\textcolor{ohmred}{Husten}} & \textbf{\textcolor{ohmred}{Röntgen}} & \textbf{\textcolor{ohmred}{BSG}} & \textbf{\textcolor{ohmred}{Abhören}} &\textbf{\textcolor{ohmgreen}{Krankheit}}\\ \hline 560 | 1 & hoch & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 561 | 2 & mittel & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 562 | 3 & niedrig & leicht & Punkt & normal & fiepend & Lungenentzündung \\ 563 | 4 & hoch & mittel & Flocken & normal & blubbernd & Lungenentzündung \\ 564 | 5 & mittel & leicht & Flocken & normal & blubbernd & Lungenentzündung \\ 565 | 6 & ohne & leicht & Streifen & normal & normal & Tuberkulose \\ 566 | 7 & hoch & stark & Loch & schnell & fiepend & Tuberkulose \\ 567 | 8 & niedrig & leicht & Streifen & normal & normal & Tuberkulose \\ 568 | 9 & ohne & leicht & Punkt & schnell & fiepend & Tuberkulose \\ 569 | 10 & niedrig & mittel & Flocken & schnell & normal & Tuberkulose \\ \hline 570 | \end{tabular} 571 | 572 | \vfill 573 | 574 | \begin{tabular}{| l<{\onslide<2->} | l<{\onslide<3->} | l<{\onslide<5->} | l<{\onslide<6->} | l<{\onslide<7->} | l<{\onslide} |}\hline 575 | \textbf{\textcolor{ohmred}{Fieber}} & \textbf{Anzahl} & \textbf{LE} & \textbf{TBC} & \textbf{Formel} & \textbf{Ergebnis} \\ \hline 576 | blubbernd & 4 & $ \nicefrac{4}{4}$ & $ \nicefrac{0}{4}$ & $ \nicefrac{4}{10} \cdot \left(- \nicefrac{4}{4} \log_2 \nicefrac{4}{4} - \nicefrac{0}{4} \log_2 \nicefrac{0}{4} \right)$ & $=0$\\ \hline 577 | fiepend & 3 & $ \nicefrac{1}{3}$ & $\nicefrac{2}{3}$ & $ \nicefrac{3}{10} \cdot \left(- \nicefrac{1}{3} \log_2 \nicefrac{1}{3} - \nicefrac{2}{3} \log_2 \nicefrac{2}{3} \right)$ & $=0{,}2755$\\ \hline 578 | normal & 3 & $\nicefrac{0}{3}$ & $\nicefrac{3}{3}$ & $\nicefrac{3}{10} \cdot \left(- \nicefrac{0}{3} \log_2 \nicefrac{0}{3} - \nicefrac{3}{3} \log_2 \nicefrac{3}{3} \right)$ & $=0$\\ \hline 579 | \multicolumn{5}{r|}{$\boldsymbol{\sum}$} & \onslide<8->{$0{,}2755$} \\ \cline{6-6} 580 | \end{tabular} 581 | 582 | 583 | \end{frame} 584 | 585 | 586 | \begin{frame}{Beispiel} 587 | 588 | Informationsgewinn für Abhören 589 | 590 | \[ 591 | \begin{array}{r l l l} 592 | G(S, \text{Abhören}) &= H(S) &- \sum\limits_{\substack{i \in \{\text{blubbernd} \\ \text{fiepend, normal}\}}} \cfrac{|S_i|}{|S|}H(S_i) &= \pause \\[1em] 593 | &= 1 &-0{,}2755 &= 0{,}7245 594 | \end{array} 595 | \] 596 | 597 | \end{frame} 598 | 599 | 600 | 601 | \begin{frame}{Beispiel} 602 | 603 | \textbf{Wahl des ersten Knoten} \\[1em] 604 | 605 | \begin{center} 606 | \begin{tabular}{|l l l l l l|} \hline 607 | \textbf{\textcolor{ohmred}{Fieber}} & \textbf{\textcolor{ohmred}{Husten}} & \textbf{\textcolor{ohmred}{Röntgen}} & \textbf{\textcolor{ohmred}{BSG}} & \textbf{\textcolor{ohmred}{Abhören}} &\textbf{\textcolor{ohmgreen}{Krankheit}}\\ \hline 608 | 0{,}4490 & 0{,}0390 & 0{,}4390 & 0{,}3958 & 0{,}7245 & 1 \\ \hline 609 | \end{tabular} 610 | 611 | \vfill 612 | 613 | \pause 614 | 615 | \begin{tikzpicture}[level distance=1.5cm, 616 | level 1/.style={sibling distance=4cm}, 617 | level 2/.style={sibling distance=2cm}] 618 | \tikzstyle{every node}=[rectangle,draw] 619 | \node (Root) [ohmred] {Abhören} 620 | child { 621 | node [ohmgreen] {Lungenentzündung} 622 | edge from parent node[left,draw=none] {blubbernd $\;$} 623 | } 624 | child { 625 | node [ohmred] {?} 626 | edge from parent node[right,draw=none] { $\;$ fiepend} 627 | } 628 | child { 629 | node [ohmgreen] {TBC} 630 | edge from parent node[right,draw=none] { $\;$ normal} 631 | }; 632 | \end{tikzpicture} 633 | \end{center} 634 | 635 | 636 | \end{frame} 637 | 638 | 639 | 640 | 641 | \begin{frame}{Beispiel} 642 | 643 | \textbf{Informationsgehalt für Fieber} \\[1em] 644 | 645 | \begin{tabu}{|l l l l l l | l |}\hline 646 | \textbf{Patient} & \textbf{\textcolor{ohmred}{Fieber}} & \textbf{\textcolor{ohmred}{Husten}} & \textbf{\textcolor{ohmred}{Röntgen}} & \textbf{\textcolor{ohmred}{BSG}} & \textbf{\textcolor{ohmred}{Abhören}} &\textbf{\textcolor{ohmgreen}{Krankheit}}\\ \hline 647 | \rowfont{\color{gray}}1 & hoch & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 648 | \rowfont{\color{gray}}2 & mittel & stark & Flocken & normal & blubbernd & Lungenentzündung \\ 649 | 3 & niedrig & leicht & Punkt & normal & fiepend & Lungenentzündung \\ 650 | \rowfont{\color{gray}}4 & hoch & mittel & Flocken & normal & blubbernd & Lungenentzündung \\ 651 | \rowfont{\color{gray}}5 & mittel & leicht & Flocken & normal & blubbernd & Lungenentzündung \\ 652 | \rowfont{\color{gray}}6 & ohne & leicht & Streifen & normal & normal & Tuberkulose \\ 653 | 7 & hoch & stark & Loch & schnell & fiepend & Tuberkulose \\ 654 | \rowfont{\color{gray}}8 & niedrig & leicht & Streifen & normal & normal & Tuberkulose \\ 655 | 9 & ohne & leicht & Punkt & schnell & fiepend & Tuberkulose \\ 656 | \rowfont{\color{gray}}10 & niedrig & mittel & Flocken & schnell & normal & Tuberkulose \\ \hline 657 | \end{tabu} 658 | 659 | \vfill 660 | 661 | \begin{tabular}{| l<{\onslide<2->} | l<{\onslide<3->} | l<{\onslide<5->} | l<{\onslide<6->} | l<{\onslide<7->} | l<{\onslide} |}\hline 662 | \textbf{\textcolor{ohmred}{Fieber}} & \textbf{Anzahl} & \textbf{LE} & \textbf{TBC} & \textbf{Formel} & \textbf{Ergebnis} \\ \hline 663 | niedrig & 1 & $ \nicefrac{1}{1}$ & $ \nicefrac{0}{1}$ & $ \nicefrac{1}{3} \cdot \left(- \nicefrac{1}{1} \log_2 \nicefrac{1}{1} - \nicefrac{0}{1} \log_2 \nicefrac{0}{1} \right)$ & $=0$\\ \hline 664 | hoch & 1 & $ \nicefrac{0}{1}$ & $\nicefrac{1}{1}$ & $ \nicefrac{1}{3} \cdot \left(- \nicefrac{0}{1} \log_2 \nicefrac{0}{1} - \nicefrac{1}{1} \log_2 \nicefrac{1}{1} \right)$ & $=0$\\ \hline 665 | ohne & 1 & $\nicefrac{0}{1}$ & $\nicefrac{1}{1}$ & $\nicefrac{1}{3} \cdot \left(- \nicefrac{0}{1} \log_2 \nicefrac{0}{1} - \nicefrac{1}{11} \log_2 \nicefrac{1}{1} \right)$ & $=0$\\ \hline 666 | \multicolumn{5}{r|}{$\boldsymbol{\sum}$} & \onslide<7->{$0$} \\ \cline{6-6} 667 | \end{tabular} 668 | 669 | 670 | \end{frame} 671 | 672 | 673 | \begin{frame}{Beispiel} 674 | 675 | \textbf{Informationsgewinn für Fieber}\\[1em] 676 | 677 | \[ 678 | \begin{array}{r l l l} 679 | G(S, \text{Fieber}) &= H(S) &- \sum\limits_{\substack{i \in \{\text{niedrig} \\ \text{hoch, normal}\}}} \cfrac{|S_i|}{|S|}H(S_i) &= \pause \\[1em] 680 | &= 0{,}9183 &-0 &= 0{,}9183 681 | \end{array} 682 | \] 683 | 684 | \end{frame} 685 | 686 | 687 | \begin{frame}{Beispiel} 688 | 689 | \textbf{Resultierender Entscheidungsbaum} \\[2em] 690 | 691 | \begin{center} 692 | 693 | \begin{tikzpicture}[level distance=1.5cm, 694 | level 1/.style={sibling distance=4cm}, 695 | level 2/.style={sibling distance=3cm}] 696 | \tikzstyle{every node}=[rectangle,draw] 697 | \node (Root) [ohmred] {Abhören} 698 | child { 699 | node [ohmgreen] {Lungenentzündung} 700 | edge from parent node[left,draw=none] {blubbernd $\quad$} 701 | } 702 | child { 703 | node [ohmred] {Fieber} 704 | child { 705 | node [ohmgreen] {Lungenentzündung} 706 | edge from parent node[left,draw=none] {niedrig $\;$} 707 | } 708 | child { 709 | node [ohmgreen] {TBC} 710 | edge from parent node[left,draw=none] {hoch } 711 | } 712 | child { 713 | node [ohmgreen] {TBC} 714 | edge from parent node[right,draw=none] {$\;$ ohne} 715 | } 716 | edge from parent node[right,draw=none] {fiepend} 717 | } 718 | child { 719 | node [ohmgreen] {TBC} 720 | edge from parent node[right,draw=none] { $\quad$ normal} 721 | }; 722 | \end{tikzpicture} 723 | \end{center} 724 | 725 | 726 | \end{frame} 727 | 728 | 729 | 730 | 731 | 732 | \section{Anwendung -- Bewegungsdaten} 733 | \subsection{Einführung} 734 | \begin{frame}{Einführung} 735 | \textbf{Allgemeines}\\[1em] 736 | \begin{itemize}[<+->] 737 | \item Daten aus meiner Bachelorarbeit 738 | \item Nicht vollständig 739 | \item Uniformisierte Daten (vier Klassen à 876 Samples) 740 | \item GPS Geschwindigkeit und Beschleunigungslevel 741 | \end{itemize} 742 | 743 | \vfill \pause 744 | 745 | \textbf{Berechnung}\\[1em] 746 | Betrag der Beschleunigung 747 | \begin{equation} 748 | m_i = \sqrt{x_i^2 + y_i^2 + z_i^2}, \qquad i = 1, \dots, n 749 | \end{equation} 750 | mit $x_i, y_i, z_i$ als Beschleunigungswerte entlang der entsprechenden Achse für jeden Datenpunkt $i$ der gesamtem Samples $n$. 751 | 752 | \end{frame} 753 | 754 | 755 | \begin{frame}{Filterung} 756 | \centering 757 | \setlength\figureheight{0.4\textwidth} 758 | \setlength\figurewidth{0.8\textwidth} 759 | \input{src/nfmoving.tikz} 760 | \end{frame} 761 | 762 | 763 | 764 | \begin{frame}{Unterscheidung} 765 | \centering 766 | \setlength\figureheight{0.45\textwidth} 767 | \setlength\figurewidth{0.8\textwidth} 768 | \input{src/filteredAccelerationLevel.tikz} 769 | \end{frame} 770 | 771 | 772 | 773 | \subsection{Entscheidungsbaum} 774 | \begin{frame}{Entscheidungsbaum für Bewegungsmuster} 775 | \centering 776 | \setlength\figureheight{0.45\textwidth} 777 | \setlength\figurewidth{0.8\textwidth} 778 | \input{src/fullTree.tikz} 779 | 780 | Tiefe: 21 781 | \end{frame} 782 | 783 | 784 | \subsection{Under- \& Overfitting} 785 | 786 | \begin{frame}{Under- \& Overfitting (1)} 787 | 788 | \textbf{Was ist Overfitting? -- Eine anschauliche Erklärung} 789 | 790 | Klassifikation einer Eiche anhand ihrer Silhouette 791 | 792 | \pause 793 | 794 | \begin{center} 795 | \includegraphics[height=0.9\textheight]{src/baumsilhouette} 796 | \end{center} 797 | 798 | 799 | \end{frame} 800 | 801 | 802 | 803 | \begin{frame}{Blick zur Tafel} 804 | \centering 805 | \includegraphics[width=\linewidth]{src/blackboard} 806 | \end{frame} 807 | 808 | 809 | 810 | \begin{frame}{Under- \& Overfitting (1)} 811 | 812 | \textbf{Was ist Overfitting? -- Eine anschauliche Erklärung} 813 | 814 | Klassifikation einer Eiche anhand ihrer Silhouette 815 | 816 | \begin{center} 817 | \includegraphics[height=0.9\textheight]{src/baumsilhouette} \pause 818 | \includegraphics[height=0.9\textheight]{src/baumsilhouettewinter} 819 | \end{center} 820 | 821 | 822 | \end{frame} 823 | 824 | 825 | \begin{frame}{Under- \& Overfitting (1)} 826 | 827 | \textbf{Was ist Overfitting? -- Eine anschauliche Erklärung} 828 | 829 | Klassifikation einer Eiche anhand ihrer Silhouette 830 | 831 | \begin{center} 832 | \includegraphics[height=0.9\textheight]{src/lollischwarz} \pause 833 | \includegraphics[height=0.9\textheight]{src/lollibunt} 834 | \end{center} 835 | 836 | 837 | \end{frame} 838 | 839 | 840 | 841 | 842 | 843 | \begin{frame}{Under- \& Overfitting (2)} 844 | 845 | \textbf{Was ist Overfitting? -- Eine mathematische Erklärung}\\[1em] 846 | 847 | \setlength\figureheight{0.3\linewidth} 848 | \setlength\figurewidth{0.45\linewidth} 849 | 850 | \begin{columns}[t] 851 | \begin{column}{0.5\linewidth} \pause 852 | \centering 853 | \input{src/actualSample.tikz} 854 | \end{column} 855 | \begin{column}{0.5\linewidth} \pause 856 | \centering 857 | \input{src/underfittingSample.tikz} 858 | \end{column} 859 | \end{columns} 860 | 861 | \begin{columns}[t] 862 | \begin{column}{0.5\linewidth} \pause 863 | \centering 864 | \input{src/goodfittingSample.tikz} 865 | \end{column} 866 | \begin{column}{0.5\linewidth} \pause 867 | \centering 868 | \input{src/overfittingSample.tikz} 869 | \end{column} 870 | \end{columns} 871 | 872 | 873 | \end{frame} 874 | 875 | 876 | 877 | 878 | 879 | 880 | 881 | \begin{frame}{Under- \& Overfitting (3)} 882 | 883 | \textbf{Was ist Overfitting? -- Eine anwendungsorientierte Erklärung}\\[1em] 884 | 885 | \centering 886 | \setlength\figureheight{0.45\textwidth} 887 | \setlength\figurewidth{0.8\textwidth} 888 | \input{src/overfitting.tikz} 889 | \end{frame} 890 | 891 | 892 | 893 | \subsection{Optimierungen} 894 | 895 | \begin{frame}{Optimierungen} 896 | \begin{itemize}[<+->] 897 | \item Pruning mit Schwellwert 898 | \item Reduced-Error-Pruning 899 | \item Cross Validation 900 | 901 | \pause 902 | 903 | \textcolor{ohmgreen}{Trainingsdaten} und \textcolor{ohmred}{Testdaten}: \\[1em] 904 | 905 | \begin{tikzpicture}[rotate=0] 906 | \draw[fill=ohmred] (0,0) circle [radius=0.5]; 907 | \clip (0,0) circle [radius=0.49]; 908 | \draw[fill= ohmgreen] (0,0) -- (72:1) -- (144:1); 909 | \draw[fill= ohmgreen] (0,0) -- (144:1) -- (216:1); 910 | \draw[fill= ohmgreen] (0,0) -- (216:1) -- (288:1); 911 | \draw[fill= ohmgreen] (0,0) -- (288:1)-- (360:1); 912 | \draw[] (0,0) -- (360:1); 913 | \end{tikzpicture} 914 | % 915 | \begin{tikzpicture}[rotate=72] 916 | \draw[fill=ohmred] (0,0) circle [radius=0.5]; 917 | \clip (0,0) circle [radius=0.49]; 918 | \draw[fill= ohmgreen] (0,0) -- (72:1) -- (144:1); 919 | \draw[fill= ohmgreen] (0,0) -- (144:1) -- (216:1); 920 | \draw[fill= ohmgreen] (0,0) -- (216:1) -- (288:1); 921 | \draw[fill= ohmgreen] (0,0) -- (288:1)-- (360:1); 922 | \draw[] (0,0) -- (360:1); 923 | \end{tikzpicture} 924 | % 925 | \begin{tikzpicture}[rotate=144] 926 | \draw[fill=ohmred] (0,0) circle [radius=0.5]; 927 | \clip (0,0) circle [radius=0.49]; 928 | \draw[fill= ohmgreen] (0,0) -- (72:1) -- (144:1); 929 | \draw[fill= ohmgreen] (0,0) -- (144:1) -- (216:1); 930 | \draw[fill= ohmgreen] (0,0) -- (216:1) -- (288:1); 931 | \draw[fill= ohmgreen] (0,0) -- (288:1)-- (360:1); 932 | \draw[] (0,0) -- (360:1); 933 | \end{tikzpicture} 934 | % 935 | \begin{tikzpicture}[rotate=216] 936 | \draw[fill=ohmred] (0,0) circle [radius=0.5]; 937 | \clip (0,0) circle [radius=0.49]; 938 | \draw[fill= ohmgreen] (0,0) -- (72:1) -- (144:1); 939 | \draw[fill= ohmgreen] (0,0) -- (144:1) -- (216:1); 940 | \draw[fill= ohmgreen] (0,0) -- (216:1) -- (288:1); 941 | \draw[fill= ohmgreen] (0,0) -- (288:1)-- (360:1); 942 | \draw[] (0,0) -- (360:1); 943 | \end{tikzpicture} 944 | % 945 | \begin{tikzpicture}[rotate=288] 946 | \draw[fill=ohmred] (0,0) circle [radius=0.5]; 947 | \clip (0,0) circle [radius=0.49]; 948 | \draw[fill= ohmgreen] (0,0) -- (72:1) -- (144:1); 949 | \draw[fill= ohmgreen] (0,0) -- (144:1) -- (216:1); 950 | \draw[fill= ohmgreen] (0,0) -- (216:1) -- (288:1); 951 | \draw[fill= ohmgreen] (0,0) -- (288:1)-- (360:1); 952 | \draw[] (0,0) -- (360:1); 953 | \end{tikzpicture} 954 | % 955 | \item Bagging (\underline{B}ootstrap \underline{agg}regat\underline{ing}) 956 | \item Induktiver Bias 957 | \item Anderes Kriterium für Bestenauswahl (z.B. Gini-Index $\sum_i P(C_i)^2$) 958 | \end{itemize} 959 | 960 | 961 | \end{frame} 962 | 963 | 964 | 965 | \subsection{Ergebnisse \& Vergleiche} 966 | \begin{frame}{Ergebnis} 967 | \setlength\figureheight{0.4\textwidth} 968 | \setlength\figurewidth{0.45\textwidth} 969 | \begin{columns}[b] 970 | \column[t]{0.45\textwidth} \centering \textbf{Kompletter Entscheidungsbaum} \\[1em] \input{src/fullTree.tikz} \\ Tiefe: 21 \\ Genauigkeit: 91{,}1 \% \pause 971 | \column[t]{0.45\textwidth} \centering \textbf{Bester Entscheidungsbaum} \\[1em] \input{src/bestTree.tikz} \\ Tiefe: 8 \\ Genauigkeit: 92{,}3 \% 972 | \end{columns} 973 | 974 | 975 | 976 | 977 | 978 | 979 | \end{frame} 980 | 981 | 982 | \section{Ausblick \& Zusammenfassung} 983 | 984 | \subsection{Anwendungsgebiete} 985 | \begin{frame}{Anwendungsgebiete} 986 | 987 | \begin{itemize}[<+->] 988 | \item Medizin 989 | \item Klassifikation 990 | \item Regression 991 | \item Data-Mining 992 | \item SPAM-Filter 993 | \end{itemize} 994 | 995 | 996 | \end{frame} 997 | 998 | \subsection{Ausblick} 999 | \begin{frame}{Ausblick} 1000 | \begin{itemize}[<+->] 1001 | \item CHAID %Chi-Quadrat-Unabhängigkeitstest verwendet 1002 | \item CART 1003 | \item C4.5 und C5.0 1004 | \item Entscheidungswälder 1005 | \item Kombination mit künstlichen neuronalen Netzen 1006 | \end{itemize} 1007 | 1008 | \end{frame} 1009 | 1010 | 1011 | \subsection{Zusammenfassung} 1012 | \begin{frame}{Zusammenfassung} 1013 | \begin{itemize}[<+->] 1014 | \item Was ist ein Entscheidungsbaum? 1015 | \item Wie konstruiere ich einen Entscheidungsbaum? 1016 | \item Warum haben Atomkraftwerke Kühltürme oder was ist Entropie? 1017 | \item Was ist Informationsgehalt und -gewinn? 1018 | \item Wie funktioniert der ID3-Algorithmus? 1019 | \item Worin liegen die Stärken und Schwächen eines Entscheidungsbaumes? 1020 | \item Was ist Overfitting? 1021 | \item Wo gibt es Optimierungsmöglichkeiten? 1022 | \item Was sind die Einsatzgebiete von Entscheidungsbäumen? 1023 | \item Welche weiteren Algorithmen für Entscheidungsbäume gibt es neben des ID3-Algorithmus' noch? 1024 | 1025 | \end{itemize} 1026 | 1027 | 1028 | \end{frame} 1029 | 1030 | 1031 | \begin{frame}{Ende} 1032 | \centering 1033 | Vielen Dank für die Aufmerksamkeit! \\[3em] 1034 | \textbf{Fragen?} 1035 | \end{frame} 1036 | 1037 | 1038 | 1039 | 1040 | 1041 | %% All of the following is optional and typically not needed. 1042 | %\appendix 1043 | %\section*{\appendixname} 1044 | %\subsection*{For Further Reading} 1045 | % 1046 | %\begin{frame}[allowframebreaks] 1047 | % \frametitle{For Further Reading} 1048 | % 1049 | % \begin{thebibliography}{10} 1050 | % 1051 | % \beamertemplatebookbibitems 1052 | % % Start with overview books. 1053 | % 1054 | % \bibitem{Author1990} 1055 | % A.~Author. 1056 | % \newblock {\em Handbook of Everything}. 1057 | % \newblock Some Press, 1990. 1058 | % 1059 | % 1060 | % \beamertemplatearticlebibitems 1061 | % % Followed by interesting articles. Keep the list short. 1062 | % 1063 | % \bibitem{Someone2000} 1064 | % S.~Someone. 1065 | % \newblock On this and that. 1066 | % \newblock {\em Journal of This and That}, 2(1):50--100, 1067 | % 2000. 1068 | % \end{thebibliography} 1069 | %\end{frame} 1070 | 1071 | \end{document} 1072 | -------------------------------------------------------------------------------- /02_Praesentation/src/actual.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=2, 17 | xtick={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2}, 18 | xticklabels={\empty}, 19 | xlabel={\$x\$}, 20 | ymin=-1, 21 | ymax=2, 22 | ytick={-1,-0.5,0,0.5,1,1.5,2}, 23 | yticklabels={\empty}, 24 | ylabel={\$y\$} 25 | ] 26 | \addplot [ 27 | color=green, 28 | dashed, 29 | forget plot 30 | ] 31 | table[row sep=crcr]{ 32 | 0 0\\ 33 | 0.105263157894737 0.283714827234291\\ 34 | 0.210526315789474 0.50794576468873\\ 35 | 0.315789473684211 0.679690917043301\\ 36 | 0.421052631578947 0.805948388977985\\ 37 | 0.526315789473684 0.893716285172766\\ 38 | 0.631578947368421 0.949992710307625\\ 39 | 0.736842105263158 0.981775769062546\\ 40 | 0.842105263157895 0.99606356611751\\ 41 | 0.947368421052632 0.9998542061525\\ 42 | 1.05263157894737 1.0001457938475\\ 43 | 1.15789473684211 1.00393643388249\\ 44 | 1.26315789473684 1.01822423093745\\ 45 | 1.36842105263158 1.05000728969237\\ 46 | 1.47368421052632 1.10628371482723\\ 47 | 1.57894736842105 1.19405161102201\\ 48 | 1.68421052631579 1.3203090829567\\ 49 | 1.78947368421053 1.49205423531127\\ 50 | 1.89473684210526 1.71628517276571\\ 51 | 2 2\\ 52 | }; 53 | \addplot [ 54 | color=blue, 55 | only marks, 56 | mark=+, 57 | mark options={solid}, 58 | forget plot 59 | ] 60 | table[row sep=crcr]{ 61 | 0.210526315789474 0.554349825625032\\ 62 | 0.526315789473684 1.53921633685923\\ 63 | 0.631578947368421 0.968052581929262\\ 64 | 0.736842105263158 1.04815553394038\\ 65 | 1.15789473684211 1.28604209524989\\ 66 | 1.36842105263158 1.54169027463541\\ 67 | 1.47368421052632 1.82490203876711\\ 68 | 1.57894736842105 1.63265070173874\\ 69 | 1.68421052631579 1.40288852115483\\ 70 | }; 71 | \addplot [ 72 | color=blue, 73 | only marks, 74 | mark=o, 75 | mark options={solid}, 76 | forget plot 77 | ] 78 | table[row sep=crcr]{ 79 | 0 -0.607707248491698\\ 80 | 0.105263157894737 -0.193560463467859\\ 81 | 0.315789473684211 -0.27674862622113\\ 82 | 0.421052631578947 0.476001117914799\\ 83 | 0.842105263157895 0.595267338125193\\ 84 | 0.947368421052632 0.62202348258518\\ 85 | 1.05263157894737 0.424367622586501\\ 86 | 1.26315789473684 0.892120428448189\\ 87 | 1.78947368421053 1.34006056832992\\ 88 | 1.89473684210526 1.20427568536131\\ 89 | 2 1.95925454139375\\ 90 | }; 91 | \end{axis} 92 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/actualSample.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=2, 17 | xtick={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2}, 18 | xticklabels={\empty}, 19 | %xlabel={x}, 20 | ymin=-1, 21 | ymax=2, 22 | ytick={-1,-0.5,0,0.5,1,1.5,2}, 23 | yticklabels={\empty}, 24 | %ylabel={y} 25 | ] 26 | \addplot [ 27 | color=ohmgreen, 28 | dashed, 29 | forget plot 30 | ] 31 | table[row sep=crcr]{ 32 | 0 0\\ 33 | 0.105263157894737 0.283714827234291\\ 34 | 0.210526315789474 0.50794576468873\\ 35 | 0.315789473684211 0.679690917043301\\ 36 | 0.421052631578947 0.805948388977985\\ 37 | 0.526315789473684 0.893716285172766\\ 38 | 0.631578947368421 0.949992710307625\\ 39 | 0.736842105263158 0.981775769062546\\ 40 | 0.842105263157895 0.99606356611751\\ 41 | 0.947368421052632 0.9998542061525\\ 42 | 1.05263157894737 1.0001457938475\\ 43 | 1.15789473684211 1.00393643388249\\ 44 | 1.26315789473684 1.01822423093745\\ 45 | 1.36842105263158 1.05000728969237\\ 46 | 1.47368421052632 1.10628371482723\\ 47 | 1.57894736842105 1.19405161102201\\ 48 | 1.68421052631579 1.3203090829567\\ 49 | 1.78947368421053 1.49205423531127\\ 50 | 1.89473684210526 1.71628517276571\\ 51 | 2 2\\ 52 | }; 53 | \addplot [ 54 | color=blue, 55 | only marks, 56 | mark=+, 57 | mark options={solid}, 58 | forget plot 59 | ] 60 | table[row sep=crcr]{ 61 | 0.210526315789474 0.740086643568247\\ 62 | 0.421052631578947 1.15661215613222\\ 63 | 0.526315789473684 1.26387315802164\\ 64 | 0.631578947368421 1.54536820357361\\ 65 | 0.736842105263158 1.57646482741354\\ 66 | 1.26315789473684 1.84459521143237\\ 67 | 1.36842105263158 1.83993016576459\\ 68 | 1.47368421052632 1.25385192431208\\ 69 | 1.68421052631579 1.67571298787751\\ 70 | }; 71 | \addplot [ 72 | color=blue, 73 | only marks, 74 | mark=o, 75 | mark options={solid}, 76 | forget plot 77 | ] 78 | table[row sep=crcr]{ 79 | 0 -0.94973934981283\\ 80 | 0.105263157894737 -0.0114064877954784\\ 81 | 0.315789473684211 0.228558913453212\\ 82 | 0.842105263157895 0.751642974658432\\ 83 | 0.947368421052632 0.471435402852224\\ 84 | 1.05263157894737 0.924340802677373\\ 85 | 1.15789473684211 0.571509732448698\\ 86 | 1.57894736842105 1.08048807903004\\ 87 | 1.78947368421053 1.06391742312104\\ 88 | 1.89473684210526 1.55377678479138\\ 89 | 2 1.83476664984637\\ 90 | }; 91 | \end{axis} 92 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/akw.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/akw.jpg -------------------------------------------------------------------------------- /02_Praesentation/src/baumsilhouette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/baumsilhouette.png -------------------------------------------------------------------------------- /02_Praesentation/src/baumsilhouettewinter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/baumsilhouettewinter.png -------------------------------------------------------------------------------- /02_Praesentation/src/bestTree.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=1, 17 | ymin=0.1, 18 | ymax=0.9, 19 | hide axis 20 | ] 21 | \addplot [ 22 | color=ohmred, 23 | only marks, 24 | mark=o, 25 | mark options={solid}, 26 | forget plot 27 | ] 28 | table[row sep=crcr]{ 29 | 0.5 0.9\\ 30 | 0.0833333333333333 0.1\\ 31 | 0.541666666666667 0.8\\ 32 | 0.458333333333333 0.7\\ 33 | 0.875 0.2\\ 34 | 0.416666666666667 0.6\\ 35 | 0.75 0.1\\ 36 | 0.833333333333333 0.1\\ 37 | 0.916666666666667 0.1\\ 38 | 0.333333333333333 0.5\\ 39 | 0.625 0.2\\ 40 | 0.291666666666667 0.4\\ 41 | 0.5 0.1\\ 42 | 0.583333333333333 0.1\\ 43 | 0.666666666666667 0.1\\ 44 | 0.166666666666667 0.1\\ 45 | 0.333333333333333 0.3\\ 46 | 0.291666666666667 0.2\\ 47 | 0.416666666666667 0.1\\ 48 | 0.25 0.1\\ 49 | 0.333333333333333 0.1\\ 50 | }; 51 | \addplot [ 52 | color=ohmred, 53 | solid, 54 | forget plot 55 | ] 56 | table[row sep=crcr]{ 57 | 0.0833333333333333 0.1\\ 58 | 0.5 0.9\\ 59 | }; 60 | \addplot [ 61 | color=ohmred, 62 | solid, 63 | forget plot 64 | ] 65 | table[row sep=crcr]{ 66 | 0.541666666666667 0.8\\ 67 | 0.5 0.9\\ 68 | }; 69 | \addplot [ 70 | color=ohmred, 71 | solid, 72 | forget plot 73 | ] 74 | table[row sep=crcr]{ 75 | 0.458333333333333 0.7\\ 76 | 0.541666666666667 0.8\\ 77 | }; 78 | \addplot [ 79 | color=ohmred, 80 | solid, 81 | forget plot 82 | ] 83 | table[row sep=crcr]{ 84 | 0.875 0.2\\ 85 | 0.541666666666667 0.8\\ 86 | }; 87 | \addplot [ 88 | color=ohmred, 89 | solid, 90 | forget plot 91 | ] 92 | table[row sep=crcr]{ 93 | 0.416666666666667 0.6\\ 94 | 0.458333333333333 0.7\\ 95 | }; 96 | \addplot [ 97 | color=ohmred, 98 | solid, 99 | forget plot 100 | ] 101 | table[row sep=crcr]{ 102 | 0.75 0.1\\ 103 | 0.458333333333333 0.7\\ 104 | }; 105 | \addplot [ 106 | color=ohmred, 107 | solid, 108 | forget plot 109 | ] 110 | table[row sep=crcr]{ 111 | 0.833333333333333 0.1\\ 112 | 0.875 0.2\\ 113 | }; 114 | \addplot [ 115 | color=ohmred, 116 | solid, 117 | forget plot 118 | ] 119 | table[row sep=crcr]{ 120 | 0.916666666666667 0.1\\ 121 | 0.875 0.2\\ 122 | }; 123 | \addplot [ 124 | color=ohmred, 125 | solid, 126 | forget plot 127 | ] 128 | table[row sep=crcr]{ 129 | 0.333333333333333 0.5\\ 130 | 0.416666666666667 0.6\\ 131 | }; 132 | \addplot [ 133 | color=ohmred, 134 | solid, 135 | forget plot 136 | ] 137 | table[row sep=crcr]{ 138 | 0.625 0.2\\ 139 | 0.416666666666667 0.6\\ 140 | }; 141 | \addplot [ 142 | color=ohmred, 143 | solid, 144 | forget plot 145 | ] 146 | table[row sep=crcr]{ 147 | 0.291666666666667 0.4\\ 148 | 0.333333333333333 0.5\\ 149 | }; 150 | \addplot [ 151 | color=ohmred, 152 | solid, 153 | forget plot 154 | ] 155 | table[row sep=crcr]{ 156 | 0.5 0.1\\ 157 | 0.333333333333333 0.5\\ 158 | }; 159 | \addplot [ 160 | color=ohmred, 161 | solid, 162 | forget plot 163 | ] 164 | table[row sep=crcr]{ 165 | 0.583333333333333 0.1\\ 166 | 0.625 0.2\\ 167 | }; 168 | \addplot [ 169 | color=ohmred, 170 | solid, 171 | forget plot 172 | ] 173 | table[row sep=crcr]{ 174 | 0.666666666666667 0.1\\ 175 | 0.625 0.2\\ 176 | }; 177 | \addplot [ 178 | color=ohmred, 179 | solid, 180 | forget plot 181 | ] 182 | table[row sep=crcr]{ 183 | 0.166666666666667 0.1\\ 184 | 0.291666666666667 0.4\\ 185 | }; 186 | \addplot [ 187 | color=ohmred, 188 | solid, 189 | forget plot 190 | ] 191 | table[row sep=crcr]{ 192 | 0.333333333333333 0.3\\ 193 | 0.291666666666667 0.4\\ 194 | }; 195 | \addplot [ 196 | color=ohmred, 197 | solid, 198 | forget plot 199 | ] 200 | table[row sep=crcr]{ 201 | 0.291666666666667 0.2\\ 202 | 0.333333333333333 0.3\\ 203 | }; 204 | \addplot [ 205 | color=ohmred, 206 | solid, 207 | forget plot 208 | ] 209 | table[row sep=crcr]{ 210 | 0.416666666666667 0.1\\ 211 | 0.333333333333333 0.3\\ 212 | }; 213 | \addplot [ 214 | color=ohmred, 215 | solid, 216 | forget plot 217 | ] 218 | table[row sep=crcr]{ 219 | 0.25 0.1\\ 220 | 0.291666666666667 0.2\\ 221 | }; 222 | \addplot [ 223 | color=ohmred, 224 | solid, 225 | forget plot 226 | ] 227 | table[row sep=crcr]{ 228 | 0.333333333333333 0.1\\ 229 | 0.291666666666667 0.2\\ 230 | }; 231 | \end{axis} 232 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/blackboard-eps-converted-to.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/blackboard-eps-converted-to.pdf -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/apfel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/apfel.png -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/banane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/banane.png -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/grapefruit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/grapefruit.png -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/kirsche.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/kirsche.png -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/orange.png -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/traube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/traube.png -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/wassermelone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/wassermelone.png -------------------------------------------------------------------------------- /02_Praesentation/src/fruechte/zitrone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/fruechte/zitrone.png -------------------------------------------------------------------------------- /02_Praesentation/src/goodfitting.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=2, 17 | xtick={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2}, 18 | xticklabels={\empty}, 19 | xlabel={\$x\$}, 20 | ymin=-1, 21 | ymax=2, 22 | ytick={-1,-0.5,0,0.5,1,1.5,2}, 23 | yticklabels={\empty}, 24 | ylabel={\$y\$} 25 | ] 26 | \addplot [ 27 | color=green, 28 | dashed, 29 | forget plot 30 | ] 31 | table[row sep=crcr]{ 32 | 0 0\\ 33 | 0.105263157894737 0.283714827234291\\ 34 | 0.210526315789474 0.50794576468873\\ 35 | 0.315789473684211 0.679690917043301\\ 36 | 0.421052631578947 0.805948388977985\\ 37 | 0.526315789473684 0.893716285172766\\ 38 | 0.631578947368421 0.949992710307625\\ 39 | 0.736842105263158 0.981775769062546\\ 40 | 0.842105263157895 0.99606356611751\\ 41 | 0.947368421052632 0.9998542061525\\ 42 | 1.05263157894737 1.0001457938475\\ 43 | 1.15789473684211 1.00393643388249\\ 44 | 1.26315789473684 1.01822423093745\\ 45 | 1.36842105263158 1.05000728969237\\ 46 | 1.47368421052632 1.10628371482723\\ 47 | 1.57894736842105 1.19405161102201\\ 48 | 1.68421052631579 1.3203090829567\\ 49 | 1.78947368421053 1.49205423531127\\ 50 | 1.89473684210526 1.71628517276571\\ 51 | 2 2\\ 52 | }; 53 | \addplot [ 54 | color=blue, 55 | only marks, 56 | mark=+, 57 | mark options={solid}, 58 | forget plot 59 | ] 60 | table[row sep=crcr]{ 61 | 0.210526315789474 0.554349825625032\\ 62 | 0.526315789473684 1.53921633685923\\ 63 | 0.631578947368421 0.968052581929262\\ 64 | 0.736842105263158 1.04815553394038\\ 65 | 1.15789473684211 1.28604209524989\\ 66 | 1.36842105263158 1.54169027463541\\ 67 | 1.47368421052632 1.82490203876711\\ 68 | 1.57894736842105 1.63265070173874\\ 69 | 1.68421052631579 1.40288852115483\\ 70 | }; 71 | \addplot [ 72 | color=blue, 73 | only marks, 74 | mark=o, 75 | mark options={solid}, 76 | forget plot 77 | ] 78 | table[row sep=crcr]{ 79 | 0 -0.607707248491698\\ 80 | 0.105263157894737 -0.193560463467859\\ 81 | 0.315789473684211 -0.27674862622113\\ 82 | 0.421052631578947 0.476001117914799\\ 83 | 0.842105263157895 0.595267338125193\\ 84 | 0.947368421052632 0.62202348258518\\ 85 | 1.05263157894737 0.424367622586501\\ 86 | 1.26315789473684 0.892120428448189\\ 87 | 1.78947368421053 1.34006056832992\\ 88 | 1.89473684210526 1.20427568536131\\ 89 | 2 1.95925454139375\\ 90 | }; 91 | \addplot [ 92 | color=red, 93 | solid, 94 | forget plot 95 | ] 96 | table[row sep=crcr]{ 97 | 0 -0.456068039574766\\ 98 | 0.105263157894737 -0.147837575502688\\ 99 | 0.210526315789474 0.114507690501356\\ 100 | 0.315789473684211 0.335322763756626\\ 101 | 0.421052631578947 0.518962649582385\\ 102 | 0.526315789473684 0.669782353297896\\ 103 | 0.631578947368421 0.79213688022242\\ 104 | 0.736842105263158 0.890381235675218\\ 105 | 0.842105263157895 0.968870424975554\\ 106 | 0.947368421052632 1.03195945344269\\ 107 | 1.05263157894737 1.08400332639588\\ 108 | 1.15789473684211 1.1293570491544\\ 109 | 1.26315789473684 1.17237562703751\\ 110 | 1.36842105263158 1.21741406536446\\ 111 | 1.47368421052632 1.26882736945451\\ 112 | 1.57894736842105 1.33097054462694\\ 113 | 1.68421052631579 1.40819859620101\\ 114 | 1.78947368421053 1.50486652949596\\ 115 | 1.89473684210526 1.62532934983108\\ 116 | 2 1.77394206252561\\ 117 | }; 118 | \end{axis} 119 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/goodfittingSample.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=2, 17 | xtick={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2}, 18 | xticklabels={\empty}, 19 | %xlabel={\$x\$}, 20 | ymin=-1, 21 | ymax=2, 22 | ytick={-1,-0.5,0,0.5,1,1.5,2}, 23 | yticklabels={\empty}, 24 | %ylabel={\$y\$} 25 | ] 26 | \addplot [ 27 | color=green, 28 | dashed, 29 | forget plot 30 | ] 31 | table[row sep=crcr]{ 32 | 0 0\\ 33 | 0.105263157894737 0.283714827234291\\ 34 | 0.210526315789474 0.50794576468873\\ 35 | 0.315789473684211 0.679690917043301\\ 36 | 0.421052631578947 0.805948388977985\\ 37 | 0.526315789473684 0.893716285172766\\ 38 | 0.631578947368421 0.949992710307625\\ 39 | 0.736842105263158 0.981775769062546\\ 40 | 0.842105263157895 0.99606356611751\\ 41 | 0.947368421052632 0.9998542061525\\ 42 | 1.05263157894737 1.0001457938475\\ 43 | 1.15789473684211 1.00393643388249\\ 44 | 1.26315789473684 1.01822423093745\\ 45 | 1.36842105263158 1.05000728969237\\ 46 | 1.47368421052632 1.10628371482723\\ 47 | 1.57894736842105 1.19405161102201\\ 48 | 1.68421052631579 1.3203090829567\\ 49 | 1.78947368421053 1.49205423531127\\ 50 | 1.89473684210526 1.71628517276571\\ 51 | 2 2\\ 52 | }; 53 | \addplot [ 54 | color=blue, 55 | only marks, 56 | mark=+, 57 | mark options={solid}, 58 | forget plot 59 | ] 60 | table[row sep=crcr]{ 61 | 0.210526315789474 0.740086643568247\\ 62 | 0.421052631578947 1.15661215613222\\ 63 | 0.526315789473684 1.26387315802164\\ 64 | 0.631578947368421 1.54536820357361\\ 65 | 0.736842105263158 1.57646482741354\\ 66 | 1.26315789473684 1.84459521143237\\ 67 | 1.36842105263158 1.83993016576459\\ 68 | 1.47368421052632 1.25385192431208\\ 69 | 1.68421052631579 1.67571298787751\\ 70 | }; 71 | \addplot [ 72 | color=blue, 73 | only marks, 74 | mark=o, 75 | mark options={solid}, 76 | forget plot 77 | ] 78 | table[row sep=crcr]{ 79 | 0 -0.94973934981283\\ 80 | 0.105263157894737 -0.0114064877954784\\ 81 | 0.315789473684211 0.228558913453212\\ 82 | 0.842105263157895 0.751642974658432\\ 83 | 0.947368421052632 0.471435402852224\\ 84 | 1.05263157894737 0.924340802677373\\ 85 | 1.15789473684211 0.571509732448698\\ 86 | 1.57894736842105 1.08048807903004\\ 87 | 1.78947368421053 1.06391742312104\\ 88 | 1.89473684210526 1.55377678479138\\ 89 | 2 1.83476664984637\\ 90 | }; 91 | \addplot [ 92 | color=red, 93 | solid, 94 | forget plot 95 | ] 96 | table[row sep=crcr]{ 97 | 0 -0.610609542570611\\ 98 | 0.105263157894737 -0.100942836595595\\ 99 | 0.210526315789474 0.309833061554594\\ 100 | 0.315789473684211 0.631734008193647\\ 101 | 0.421052631578947 0.874775859635253\\ 102 | 0.526315789473684 1.0489744721931\\ 103 | 0.631578947368421 1.16434570218089\\ 104 | 0.736842105263158 1.23090540591229\\ 105 | 0.842105263157895 1.25866943970101\\ 106 | 0.947368421052632 1.25765365986074\\ 107 | 1.05263157894737 1.23787392270515\\ 108 | 1.15789473684211 1.20934608454795\\ 109 | 1.26315789473684 1.18208600170282\\ 110 | 1.36842105263158 1.16610953048345\\ 111 | 1.47368421052632 1.17143252720353\\ 112 | 1.57894736842105 1.20807084817676\\ 113 | 1.68421052631579 1.28604034971682\\ 114 | 1.78947368421053 1.4153568881374\\ 115 | 1.89473684210526 1.60603631975219\\ 116 | 2 1.86809450087488\\ 117 | }; 118 | \end{axis} 119 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/logo.png -------------------------------------------------------------------------------- /02_Praesentation/src/logo_.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/logo_.png -------------------------------------------------------------------------------- /02_Praesentation/src/lollibunt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/lollibunt.png -------------------------------------------------------------------------------- /02_Praesentation/src/lollischwarz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/michaeldorner/DecisionTrees/acad294175cc31a8c3c2ee173274134e404cbf5d/02_Praesentation/src/lollischwarz.png -------------------------------------------------------------------------------- /02_Praesentation/src/overfitting.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture}[font=\sffamily\sansmath] 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=150, 17 | ymin=87, 18 | ymax=95, 19 | xlabel={Anzahl der Knoten}, 20 | ylabel={Genauigkeit in \%}, 21 | axis x line*=bottom, 22 | axis y line*=left, 23 | legend style={at={(0.03,0.97)},anchor=north west,draw=black,fill=white,legend cell align=left} 24 | ] 25 | \addplot [ 26 | color=ohmred, 27 | solid 28 | ] 29 | table[row sep=crcr]{ 30 | 9 88.89272658693\\ 31 | 13 88.89272658693\\ 32 | 15 88.89272658693\\ 33 | 17 88.89272658693\\ 34 | 19 88.89272658693\\ 35 | 21 88.89272658693\\ 36 | 23 89.1850636403039\\ 37 | 25 89.1850636403039\\ 38 | 27 89.1850636403039\\ 39 | 31 89.1850636403039\\ 40 | 33 89.2474492448748\\ 41 | 37 90.3740148848439\\ 42 | 39 90.5330118641541\\ 43 | 41 90.6350676432999\\ 44 | 43 91.2105477456059\\ 45 | 45 91.413153670209\\ 46 | 49 91.5355027729822\\ 47 | 51 91.6170688414977\\ 48 | 55 91.7643797116905\\ 49 | 59 91.845945780206\\ 50 | 61 91.9682948829792\\ 51 | 63 92.6487838591103\\ 52 | 67 93.0050460674491\\ 53 | 73 93.1258785058728\\ 54 | 75 93.1652485846129\\ 55 | 77 93.3295538891465\\ 56 | 79 93.4651057653867\\ 57 | 81 93.5037175119521\\ 58 | 87 93.6610155233515\\ 59 | 93 93.7397556808318\\ 60 | 97 93.8161296900072\\ 61 | 101 93.8554997687474\\ 62 | 111 94.0525813972391\\ 63 | 115 94.1336877030243\\ 64 | 123 94.2102440157609\\ 65 | 125 94.2102440157609\\ 66 | 131 94.2549224197245\\ 67 | 133 94.2935341662898\\ 68 | 141 94.3692409950711\\ 69 | }; 70 | \addlegendentry{Training}; 71 | 72 | \addplot [ 73 | color=ohmgreen, 74 | solid 75 | ] 76 | table[row sep=crcr]{ 77 | 9 88.0593842469951\\ 78 | 13 88.0593842469951\\ 79 | 15 88.0593842469951\\ 80 | 17 88.0593842469951\\ 81 | 19 88.0593842469951\\ 82 | 21 88.0593842469951\\ 83 | 23 87.9363789823697\\ 84 | 25 87.9363789823697\\ 85 | 27 87.9363789823697\\ 86 | 31 87.9363789823697\\ 87 | 33 87.6823925984445\\ 88 | 37 88.3392407115438\\ 89 | 39 88.2404264822947\\ 90 | 41 87.6351423632067\\ 91 | 43 88.948854179426\\ 92 | 45 89.4354109356141\\ 93 | 49 89.5304679698347\\ 94 | 51 89.7205820382757\\ 95 | 55 90.572464430401\\ 96 | 59 90.572464430401\\ 97 | 61 90.6637642695931\\ 98 | 63 91.5064480259885\\ 99 | 67 92.3018820705657\\ 100 | 73 92.3931819097577\\ 101 | 75 92.3931819097577\\ 102 | 77 92.4821557178367\\ 103 | 79 92.4477142437416\\ 104 | 81 92.3489000144926\\ 105 | 87 92.5465284729906\\ 106 | 93 92.6453427022396\\ 107 | 97 92.5465284729906\\ 108 | 101 92.5465284729906\\ 109 | 111 91.9742915679692\\ 110 | 115 92.0645442755504\\ 111 | 123 92.566093431385\\ 112 | 125 92.566093431385\\ 113 | 131 92.4574387809659\\ 114 | 133 92.1462354614638\\ 115 | 141 92.0523414427998\\ 116 | }; 117 | \addlegendentry{Test}; 118 | 119 | \end{axis} 120 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/overfittingSample.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=2, 17 | xtick={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2}, 18 | xticklabels={\empty}, 19 | %xlabel={\$x\$}, 20 | ymin=-1, 21 | ymax=2, 22 | ytick={-1,-0.5,0,0.5,1,1.5,2}, 23 | yticklabels={\empty}, 24 | %ylabel={\$y\$} 25 | ] 26 | \addplot [ 27 | color=green, 28 | dashed, 29 | forget plot 30 | ] 31 | table[row sep=crcr]{ 32 | 0 0\\ 33 | 0.105263157894737 0.283714827234291\\ 34 | 0.210526315789474 0.50794576468873\\ 35 | 0.315789473684211 0.679690917043301\\ 36 | 0.421052631578947 0.805948388977985\\ 37 | 0.526315789473684 0.893716285172766\\ 38 | 0.631578947368421 0.949992710307625\\ 39 | 0.736842105263158 0.981775769062546\\ 40 | 0.842105263157895 0.99606356611751\\ 41 | 0.947368421052632 0.9998542061525\\ 42 | 1.05263157894737 1.0001457938475\\ 43 | 1.15789473684211 1.00393643388249\\ 44 | 1.26315789473684 1.01822423093745\\ 45 | 1.36842105263158 1.05000728969237\\ 46 | 1.47368421052632 1.10628371482723\\ 47 | 1.57894736842105 1.19405161102201\\ 48 | 1.68421052631579 1.3203090829567\\ 49 | 1.78947368421053 1.49205423531127\\ 50 | 1.89473684210526 1.71628517276571\\ 51 | 2 2\\ 52 | }; 53 | \addplot [ 54 | color=blue, 55 | only marks, 56 | mark=+, 57 | mark options={solid}, 58 | forget plot 59 | ] 60 | table[row sep=crcr]{ 61 | 0.210526315789474 0.740086643568247\\ 62 | 0.421052631578947 1.15661215613222\\ 63 | 0.526315789473684 1.26387315802164\\ 64 | 0.631578947368421 1.54536820357361\\ 65 | 0.736842105263158 1.57646482741354\\ 66 | 1.26315789473684 1.84459521143237\\ 67 | 1.36842105263158 1.83993016576459\\ 68 | 1.47368421052632 1.25385192431208\\ 69 | 1.68421052631579 1.67571298787751\\ 70 | }; 71 | \addplot [ 72 | color=blue, 73 | only marks, 74 | mark=o, 75 | mark options={solid}, 76 | forget plot 77 | ] 78 | table[row sep=crcr]{ 79 | 0 -0.94973934981283\\ 80 | 0.105263157894737 -0.0114064877954784\\ 81 | 0.315789473684211 0.228558913453212\\ 82 | 0.842105263157895 0.751642974658432\\ 83 | 0.947368421052632 0.471435402852224\\ 84 | 1.05263157894737 0.924340802677373\\ 85 | 1.15789473684211 0.571509732448698\\ 86 | 1.57894736842105 1.08048807903004\\ 87 | 1.78947368421053 1.06391742312104\\ 88 | 1.89473684210526 1.55377678479138\\ 89 | 2 1.83476664984637\\ 90 | }; 91 | \addplot [ 92 | color=red, 93 | solid, 94 | forget plot 95 | ] 96 | table[row sep=crcr]{ 97 | 0 -0.875407370832862\\ 98 | 0.105263157894737 -0.0185340659410757\\ 99 | 0.210526315789474 0.738784122937172\\ 100 | 0.315789473684211 0.22844762922923\\ 101 | 0.421052631578947 1.15657425038964\\ 102 | 0.526315789473684 1.26386982435134\\ 103 | 0.631578947368421 1.54536807945837\\ 104 | 0.736842105263158 1.57646575482874\\ 105 | 0.842105263157895 0.751643174999624\\ 106 | 0.947368421052632 0.471433134433247\\ 107 | 1.05263157894737 0.924354205509265\\ 108 | 1.15789473684211 0.571466077908773\\ 109 | 1.26315789473684 1.84443012104253\\ 110 | 1.36842105263158 1.8394850825303\\ 111 | 1.47368421052632 1.25389961326899\\ 112 | 1.57894736842105 1.08086263874662\\ 113 | 1.68421052631579 1.67846203133801\\ 114 | 1.78947368421053 1.07141974984095\\ 115 | 1.89473684210526 1.57083872839349\\ 116 | 2 1.91791561729811\\ 117 | }; 118 | \end{axis} 119 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/underfitting.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=2, 17 | xtick={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2}, 18 | xticklabels={\empty}, 19 | xlabel={\$x\$}, 20 | ymin=-1, 21 | ymax=2, 22 | ytick={-1,-0.5,0,0.5,1,1.5,2}, 23 | yticklabels={\empty}, 24 | ylabel={\$y\$} 25 | ] 26 | \addplot [ 27 | color=green, 28 | dashed, 29 | forget plot 30 | ] 31 | table[row sep=crcr]{ 32 | 0 0\\ 33 | 0.105263157894737 0.283714827234291\\ 34 | 0.210526315789474 0.50794576468873\\ 35 | 0.315789473684211 0.679690917043301\\ 36 | 0.421052631578947 0.805948388977985\\ 37 | 0.526315789473684 0.893716285172766\\ 38 | 0.631578947368421 0.949992710307625\\ 39 | 0.736842105263158 0.981775769062546\\ 40 | 0.842105263157895 0.99606356611751\\ 41 | 0.947368421052632 0.9998542061525\\ 42 | 1.05263157894737 1.0001457938475\\ 43 | 1.15789473684211 1.00393643388249\\ 44 | 1.26315789473684 1.01822423093745\\ 45 | 1.36842105263158 1.05000728969237\\ 46 | 1.47368421052632 1.10628371482723\\ 47 | 1.57894736842105 1.19405161102201\\ 48 | 1.68421052631579 1.3203090829567\\ 49 | 1.78947368421053 1.49205423531127\\ 50 | 1.89473684210526 1.71628517276571\\ 51 | 2 2\\ 52 | }; 53 | \addplot [ 54 | color=blue, 55 | only marks, 56 | mark=+, 57 | mark options={solid}, 58 | forget plot 59 | ] 60 | table[row sep=crcr]{ 61 | 0.210526315789474 0.554349825625032\\ 62 | 0.526315789473684 1.53921633685923\\ 63 | 0.631578947368421 0.968052581929262\\ 64 | 0.736842105263158 1.04815553394038\\ 65 | 1.15789473684211 1.28604209524989\\ 66 | 1.36842105263158 1.54169027463541\\ 67 | 1.47368421052632 1.82490203876711\\ 68 | 1.57894736842105 1.63265070173874\\ 69 | 1.68421052631579 1.40288852115483\\ 70 | }; 71 | \addplot [ 72 | color=blue, 73 | only marks, 74 | mark=o, 75 | mark options={solid}, 76 | forget plot 77 | ] 78 | table[row sep=crcr]{ 79 | 0 -0.607707248491698\\ 80 | 0.105263157894737 -0.193560463467859\\ 81 | 0.315789473684211 -0.27674862622113\\ 82 | 0.421052631578947 0.476001117914799\\ 83 | 0.842105263157895 0.595267338125193\\ 84 | 0.947368421052632 0.62202348258518\\ 85 | 1.05263157894737 0.424367622586501\\ 86 | 1.26315789473684 0.892120428448189\\ 87 | 1.78947368421053 1.34006056832992\\ 88 | 1.89473684210526 1.20427568536131\\ 89 | 2 1.95925454139375\\ 90 | }; 91 | \addplot [ 92 | color=red, 93 | solid, 94 | forget plot 95 | ] 96 | table[row sep=crcr]{ 97 | 0 0.00766007449125844\\ 98 | 0.105263157894737 0.102818500105147\\ 99 | 0.210526315789474 0.197976925719036\\ 100 | 0.315789473684211 0.293135351332925\\ 101 | 0.421052631578947 0.388293776946814\\ 102 | 0.526315789473684 0.483452202560702\\ 103 | 0.631578947368421 0.578610628174591\\ 104 | 0.736842105263158 0.67376905378848\\ 105 | 0.842105263157895 0.768927479402369\\ 106 | 0.947368421052632 0.864085905016258\\ 107 | 1.05263157894737 0.959244330630146\\ 108 | 1.15789473684211 1.05440275624404\\ 109 | 1.26315789473684 1.14956118185792\\ 110 | 1.36842105263158 1.24471960747181\\ 111 | 1.47368421052632 1.3398780330857\\ 112 | 1.57894736842105 1.43503645869959\\ 113 | 1.68421052631579 1.53019488431348\\ 114 | 1.78947368421053 1.62535330992737\\ 115 | 1.89473684210526 1.72051173554126\\ 116 | 2 1.81567016115515\\ 117 | }; 118 | \end{axis} 119 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/src/underfittingSample.tikz: -------------------------------------------------------------------------------- 1 | % This file was created by matlab2tikz v0.4.4 running on MATLAB 7.14. 2 | % Copyright (c) 2008--2013, Nico Schlömer 3 | % All rights reserved. 4 | % 5 | % The latest updates can be retrieved from 6 | % http://www.mathworks.com/matlabcentral/fileexchange/22022-matlab2tikz 7 | % where you can also make suggestions and rate matlab2tikz. 8 | % 9 | \begin{tikzpicture} 10 | 11 | \begin{axis}[% 12 | width=\figurewidth, 13 | height=\figureheight, 14 | scale only axis, 15 | xmin=0, 16 | xmax=2, 17 | xtick={0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2}, 18 | xticklabels={\empty}, 19 | %xlabel={\$x\$}, 20 | ymin=-1, 21 | ymax=2, 22 | ytick={-1,-0.5,0,0.5,1,1.5,2}, 23 | yticklabels={\empty}, 24 | %ylabel={\$y\$} 25 | ] 26 | \addplot [ 27 | color=green, 28 | dashed, 29 | forget plot 30 | ] 31 | table[row sep=crcr]{ 32 | 0 0\\ 33 | 0.105263157894737 0.283714827234291\\ 34 | 0.210526315789474 0.50794576468873\\ 35 | 0.315789473684211 0.679690917043301\\ 36 | 0.421052631578947 0.805948388977985\\ 37 | 0.526315789473684 0.893716285172766\\ 38 | 0.631578947368421 0.949992710307625\\ 39 | 0.736842105263158 0.981775769062546\\ 40 | 0.842105263157895 0.99606356611751\\ 41 | 0.947368421052632 0.9998542061525\\ 42 | 1.05263157894737 1.0001457938475\\ 43 | 1.15789473684211 1.00393643388249\\ 44 | 1.26315789473684 1.01822423093745\\ 45 | 1.36842105263158 1.05000728969237\\ 46 | 1.47368421052632 1.10628371482723\\ 47 | 1.57894736842105 1.19405161102201\\ 48 | 1.68421052631579 1.3203090829567\\ 49 | 1.78947368421053 1.49205423531127\\ 50 | 1.89473684210526 1.71628517276571\\ 51 | 2 2\\ 52 | }; 53 | \addplot [ 54 | color=blue, 55 | only marks, 56 | mark=+, 57 | mark options={solid}, 58 | forget plot 59 | ] 60 | table[row sep=crcr]{ 61 | 0.210526315789474 0.740086643568247\\ 62 | 0.421052631578947 1.15661215613222\\ 63 | 0.526315789473684 1.26387315802164\\ 64 | 0.631578947368421 1.54536820357361\\ 65 | 0.736842105263158 1.57646482741354\\ 66 | 1.26315789473684 1.84459521143237\\ 67 | 1.36842105263158 1.83993016576459\\ 68 | 1.47368421052632 1.25385192431208\\ 69 | 1.68421052631579 1.67571298787751\\ 70 | }; 71 | \addplot [ 72 | color=blue, 73 | only marks, 74 | mark=o, 75 | mark options={solid}, 76 | forget plot 77 | ] 78 | table[row sep=crcr]{ 79 | 0 -0.94973934981283\\ 80 | 0.105263157894737 -0.0114064877954784\\ 81 | 0.315789473684211 0.228558913453212\\ 82 | 0.842105263157895 0.751642974658432\\ 83 | 0.947368421052632 0.471435402852224\\ 84 | 1.05263157894737 0.924340802677373\\ 85 | 1.15789473684211 0.571509732448698\\ 86 | 1.57894736842105 1.08048807903004\\ 87 | 1.78947368421053 1.06391742312104\\ 88 | 1.89473684210526 1.55377678479138\\ 89 | 2 1.83476664984637\\ 90 | }; 91 | \addplot [ 92 | color=red, 93 | solid, 94 | forget plot 95 | ] 96 | table[row sep=crcr]{ 97 | 0 0.266705526843841\\ 98 | 0.105263157894737 0.346082767193785\\ 99 | 0.210526315789474 0.42546000754373\\ 100 | 0.315789473684211 0.504837247893674\\ 101 | 0.421052631578947 0.584214488243619\\ 102 | 0.526315789473684 0.663591728593563\\ 103 | 0.631578947368421 0.742968968943508\\ 104 | 0.736842105263158 0.822346209293452\\ 105 | 0.842105263157895 0.901723449643397\\ 106 | 0.947368421052632 0.981100689993341\\ 107 | 1.05263157894737 1.06047793034329\\ 108 | 1.15789473684211 1.13985517069323\\ 109 | 1.26315789473684 1.21923241104317\\ 110 | 1.36842105263158 1.29860965139312\\ 111 | 1.47368421052632 1.37798689174306\\ 112 | 1.57894736842105 1.45736413209301\\ 113 | 1.68421052631579 1.53674137244295\\ 114 | 1.78947368421053 1.6161186127929\\ 115 | 1.89473684210526 1.69549585314284\\ 116 | 2 1.77487309349279\\ 117 | }; 118 | \end{axis} 119 | \end{tikzpicture}% -------------------------------------------------------------------------------- /02_Praesentation/theme.tex: -------------------------------------------------------------------------------- 1 | \documentclass[ucs,9pt, mathserif]{beamer} 2 | 3 | \usepackage[utf8x]{inputenc} 4 | \usepackage[german, ngerman]{babel} 5 | \usepackage{amsmath} 6 | \usepackage{amsfonts} 7 | \usepackage{amssymb} 8 | \usepackage{amsthm} 9 | \usepackage{nicefrac} 10 | \usepackage{siunitx} 11 | \usepackage{xstring} 12 | \usepackage{nicefrac} 13 | \usepackage{ulem} 14 | \usepackage{tabu} 15 | \usepackage[eulergreek]{sansmath} 16 | \usepackage{multicol} 17 | 18 | 19 | \usepackage{listings} 20 | \usepackage[ruled,vlined,german,linesnumbered, titlenotnumbered]{algorithm2e} % Algorithmenpacket 21 | 22 | \usepackage{graphicx} 23 | \usepackage{float} 24 | \usepackage{wrapfig} 25 | \usepackage{tikz} 26 | \usetikzlibrary{positioning, arrows, trees} 27 | \usepackage{fix-cm} 28 | \usepackage{pgfplots} 29 | \usepackage{multimedia} 30 | 31 | 32 | 33 | \pgfdeclareimage[height=0.7cm]{university-logo}{logo} 34 | \logo{\pgfuseimage{ohmlogo}} 35 | 36 | % large version for upper right corner of title page 37 | %\pgfdeclareimage[height=1.085cm]{big-university-logo}{FULogo_RGB} 38 | \newcommand{\titleimage}[1]{\pgfdeclareimage[height=4cm]{title-image}{#1}} 39 | 40 | 41 | \titlegraphic{\pgfuseimage{title-image}} 42 | %%% end logo 43 | 44 | % NOTE: 1cm = 0.393 in = 28.346 pt; 1 pt = 1/72 in = 0.0352 cm 45 | \setbeamersize{text margin right=3.5mm, text margin left=3.5mm} % text margin 46 | 47 | % colors to be used 48 | \definecolor{text-grey}{rgb}{0.45, 0.45, 0.45} % grey text on white background 49 | \definecolor{bg-grey}{rgb}{0.66, 0.65, 0.60} % grey background (for white text) 50 | 51 | % Farben 52 | %\definecolor{grey}{grey}{0.5} % die Farbe grau wird definiert 53 | %\definecolor{light-grey}{grey}{0.95} 54 | 55 | \definecolor{ohmyellow}{cmyk}{0.01, 0.08, 0.92, 0.01} 56 | \definecolor{ohmblue}{cmyk}{0.94, 0.63, 0.03, 0.05} 57 | \definecolor{ohmred}{cmyk}{0.02, 0.94, 0.90, 0.06} 58 | \definecolor{ohmorange}{cmyk}{0.01, 0.57, 0.91, 0.02} 59 | \definecolor{ohmcoolgrey}{cmyk}{0.55, 0.31, 0.25, 0.02} 60 | \definecolor{ohmgreen}{cmyk}{0.83, 0.03, 0.93, 0.06} 61 | 62 | %%% colors 63 | \usecolortheme{lily} 64 | 65 | \setbeamercolor{frametitle}{fg=ohmblue} 66 | \setbeamercolor{title}{fg= ohmblue} 67 | 68 | \setbeamercolor*{normal text}{fg=black,bg=white} 69 | \setbeamercolor*{alerted text}{fg=red} 70 | \setbeamercolor*{example text}{fg=green} 71 | \setbeamercolor*{structure}{fg=ohmblue} 72 | 73 | \setbeamercolor*{block title}{fg=white,bg=black!50} 74 | \setbeamercolor*{block title alerted}{fg=white,bg=black!50} 75 | \setbeamercolor*{block title example}{fg=white,bg=black!50} 76 | 77 | \setbeamercolor*{block body}{bg=black!10} 78 | \setbeamercolor*{block body alerted}{bg=black!10} 79 | \setbeamercolor*{block body example}{bg=black!10} 80 | 81 | \setbeamercolor{bibliography entry author}{fg=ohmblue} 82 | \setbeamercolor{bibliography entry journal}{fg=text-grey} 83 | 84 | \setbeamercolor{item}{fg=ohmblue} 85 | \setbeamercolor{navigation symbols}{fg=text-grey,bg=bg-grey} 86 | %%% end colors 87 | 88 | 89 | 90 | \setbeamersize{sidebar width left=0cm, sidebar width right=0mm} 91 | \setbeamertemplate{sidebar right}{} 92 | \setbeamertemplate{sidebar left}{} 93 | % XOR 94 | % \useoutertheme{sidebar} 95 | 96 | \setbeamertemplate{frametitle} 97 | 98 | \setbeamertemplate{frametitle}{% 99 | \vskip-30pt \color{black}\large\bfseries% 100 | \begin{minipage}[b][23pt]{90.5mm}% 101 | \flushleft\insertframetitle% 102 | \end{minipage}% 103 | } 104 | 105 | 106 | \setbeamertemplate{title page}{ 107 | \hfill%\begin{minipage}[t]{1cm} 108 | \includegraphics[scale=0.5]{src/logo.png} 109 | %\end{minipage} 110 | % necessary line 111 | %\begin{minipage}[b]{4.3cm} 112 | % \small{\textsf{\textbf{Technische Hochschule Nürnberg} \\ 113 | % Georg-Simon-Ohm\\[0.16cm] 114 | % Fakultät Informatik }} 115 | % \end{minipage} \\ 116 | % \vskip0pt%\hskip3pt 117 | % \begin{minipage}{15.6cm} 118 | % \hspace{-1mm}\inserttitlegraphic 119 | % \end{minipage} 120 | 121 | % set the title and the author 122 | \vskip14pt 123 | %\parbox[top][1.35cm][c]{11cm}{\huge\inserttitle \\ \small \insertsubtitle} 124 | \vskip11pt 125 | \begin{center}{\Huge Seminar Künstliche Intelligenz} 126 | 127 | \noindent\rule{\textwidth}{0.5pt} \\[0.5em] 128 | {\large\textcolor{ohmblue}{\inserttitle} } 129 | \noindent\rule{\textwidth}{0.5pt} \\[1cm] 130 | \textcolor{text-grey}{Autor} \\ 131 | {\small \insertauthor} \\[3mm] 132 | \end{center} 133 | \vfill 134 | \parbox[top][1.35cm][c]{11cm}{\small \insertdate} 135 | } 136 | %%% end title page 137 | 138 | 139 | 140 | %%% headline 141 | \setbeamertemplate{headline} 142 | { 143 | \vskip3pt\hspace{3.0mm} 144 | \begin{minipage}[b]{8cm} 145 | \sffamily \tiny \textcolor{text-grey}{\inserttitle} \\[0.5cm] 146 | \end{minipage} \hfill 147 | % necessary line 148 | %\begin{minipage}[t]{0.75cm} 149 | \includegraphics[scale=0.25]{src/logo.png}\hspace*{1em} 150 | %\end{minipage} 151 | % necessary line 152 | %\begin{minipage}[b]{2.8cm} 153 | % \tiny{\textsf{\textbf{Technische Hochschule Nürnberg} \\ 154 | % Georg-Simon-Ohm\\[0.16cm] 155 | % Fakultät Informatik }} 156 | % \end{minipage} \hspace{3.0mm} 157 | %\vskip-5pt\hfill\insertlogo\hspace{1.5mm} % logo on the right 158 | \vskip3pt\color{black}\rule{\textwidth}{0.4pt} % horizontal line 159 | } 160 | %%% end headline 161 | 162 | %%% footline 163 | %\newcommand{\footlinetext}{\insertshortinstitute, \insertshorttitle, \insertshortdate} 164 | \setbeamertemplate{footline}{ 165 | %\vskip5pt\color{black}\rule{\textwidth}{0.4pt}\\ % horizontal line 166 | 167 | %\hspace*{\fill} \makebox(0, 6)[c]{\insertpagenumber\,/\,\insertpresentationendpage} 168 | \hspace*{\fill}% 169 | \llap{\usebeamertemplate*{navigation symbols} \hspace{3.5mm}} 170 | 171 | \vskip3pt 172 | } 173 | %%% end footline 174 | 175 | 176 | \lstdefinestyle{code} { 177 | language = Python, 178 | basicstyle = \ttfamily, 179 | identifierstyle = \ttfamily, 180 | stringstyle = \ttfamily\color{ohmred}, 181 | commentstyle = \ttfamily\color{ohmgreen}, 182 | keywordstyle = \ttfamily\color{ohmblue}, 183 | columns = fullflexible, 184 | showstringspaces= false, 185 | emphstyle = \color{ohmorange}, 186 | frame = single, 187 | morekeywords = {REFERENCES, DATETIME}, 188 | emph = {Michi}, 189 | framesep = 15pt, 190 | rulesep = 15pt, 191 | framerule = 0.25pt, 192 | captionpos = b, 193 | %linewidth = 0.75\textwidth, 194 | xleftmargin = 15pt, 195 | xrightmargin = 15pt, 196 | aboveskip = 15pt, 197 | belowskip = 15pt 198 | } 199 | 200 | 201 | % matlabtikz bugfix 202 | \newlength\figureheight 203 | \newlength\figurewidth 204 | 205 | 206 | \newcommand{\nicequote}[2] 207 | { 208 | \begin{center}{\Huge \bfseries \rmfamily ``} 209 | \begin{minipage}[t]{0.75\textwidth} \itshape 210 | #2 211 | \begin{flushright} \vspace*{-0em} 212 | -- #1 213 | \end{flushright} 214 | \end{minipage} \, {\Huge \bfseries \rmfamily ''} 215 | \end{center} 216 | } 217 | 218 | 219 | 220 | 221 | \tikzset{ 222 | invisible/.style={opacity=0}, 223 | visible on/.style={alt=#1{}{invisible}}, 224 | alt/.code args={<#1>#2#3}{% 225 | \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}} % \pgfkeysalso doesn't change the path 226 | }, 227 | } 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | -------------------------------------------------------------------------------- /03_Python Code/fishiris.csv: -------------------------------------------------------------------------------- 1 | 5.1, 3.5, 1.4, 0.2, setosa 2 | 4.9, 3, 1.4, 0.2, setosa 3 | 4.7, 3.2, 1.3, 0.2, setosa 4 | 4.6, 3.1, 1.5, 0.2, setosa 5 | 5, 3.6, 1.4, 0.2, setosa 6 | 5.4, 3.9, 1.7, 0.4, setosa 7 | 4.6, 3.4, 1.4, 0.3, setosa 8 | 5, 3.4, 1.5, 0.2, setosa 9 | 4.4, 2.9, 1.4, 0.2, setosa 10 | 4.9, 3.1, 1.5, 0.1, setosa 11 | 5.4, 3.7, 1.5, 0.2, setosa 12 | 4.8, 3.4, 1.6, 0.2, setosa 13 | 4.8, 3, 1.4, 0.1, setosa 14 | 4.3, 3, 1.1, 0.1, setosa 15 | 5.8, 4, 1.2, 0.2, setosa 16 | 5.7, 4.4, 1.5, 0.4, setosa 17 | 5.4, 3.9, 1.3, 0.4, setosa 18 | 5.1, 3.5, 1.4, 0.3, setosa 19 | 5.7, 3.8, 1.7, 0.3, setosa 20 | 5.1, 3.8, 1.5, 0.3, setosa 21 | 5.4, 3.4, 1.7, 0.2, setosa 22 | 5.1, 3.7, 1.5, 0.4, setosa 23 | 4.6, 3.6, 1, 0.2, setosa 24 | 5.1, 3.3, 1.7, 0.5, setosa 25 | 4.8, 3.4, 1.9, 0.2, setosa 26 | 5, 3, 1.6, 0.2, setosa 27 | 5, 3.4, 1.6, 0.4, setosa 28 | 5.2, 3.5, 1.5, 0.2, setosa 29 | 5.2, 3.4, 1.4, 0.2, setosa 30 | 4.7, 3.2, 1.6, 0.2, setosa 31 | 4.8, 3.1, 1.6, 0.2, setosa 32 | 5.4, 3.4, 1.5, 0.4, setosa 33 | 5.2, 4.1, 1.5, 0.1, setosa 34 | 5.5, 4.2, 1.4, 0.2, setosa 35 | 4.9, 3.1, 1.5, 0.2, setosa 36 | 5, 3.2, 1.2, 0.2, setosa 37 | 5.5, 3.5, 1.3, 0.2, setosa 38 | 4.9, 3.6, 1.4, 0.1, setosa 39 | 4.4, 3, 1.3, 0.2, setosa 40 | 5.1, 3.4, 1.5, 0.2, setosa 41 | 5, 3.5, 1.3, 0.3, setosa 42 | 4.5, 2.3, 1.3, 0.3, setosa 43 | 4.4, 3.2, 1.3, 0.2, setosa 44 | 5, 3.5, 1.6, 0.6, setosa 45 | 5.1, 3.8, 1.9, 0.4, setosa 46 | 4.8, 3, 1.4, 0.3, setosa 47 | 5.1, 3.8, 1.6, 0.2, setosa 48 | 4.6, 3.2, 1.4, 0.2, setosa 49 | 5.3, 3.7, 1.5, 0.2, setosa 50 | 5, 3.3, 1.4, 0.2, setosa 51 | 7, 3.2, 4.7, 1.4, versicolor 52 | 6.4, 3.2, 4.5, 1.5, versicolor 53 | 6.9, 3.1, 4.9, 1.5, versicolor 54 | 5.5, 2.3, 4, 1.3, versicolor 55 | 6.5, 2.8, 4.6, 1.5, versicolor 56 | 5.7, 2.8, 4.5, 1.3, versicolor 57 | 6.3, 3.3, 4.7, 1.6, versicolor 58 | 4.9, 2.4, 3.3, 1, versicolor 59 | 6.6, 2.9, 4.6, 1.3, versicolor 60 | 5.2, 2.7, 3.9, 1.4, versicolor 61 | 5, 2, 3.5, 1, versicolor 62 | 5.9, 3, 4.2, 1.5, versicolor 63 | 6, 2.2, 4, 1, versicolor 64 | 6.1, 2.9, 4.7, 1.4, versicolor 65 | 5.6, 2.9, 3.6, 1.3, versicolor 66 | 6.7, 3.1, 4.4, 1.4, versicolor 67 | 5.6, 3, 4.5, 1.5, versicolor 68 | 5.8, 2.7, 4.1, 1, versicolor 69 | 6.2, 2.2, 4.5, 1.5, versicolor 70 | 5.6, 2.5, 3.9, 1.1, versicolor 71 | 5.9, 3.2, 4.8, 1.8, versicolor 72 | 6.1, 2.8, 4, 1.3, versicolor 73 | 6.3, 2.5, 4.9, 1.5, versicolor 74 | 6.1, 2.8, 4.7, 1.2, versicolor 75 | 6.4, 2.9, 4.3, 1.3, versicolor 76 | 6.6, 3, 4.4, 1.4, versicolor 77 | 6.8, 2.8, 4.8, 1.4, versicolor 78 | 6.7, 3, 5, 1.7, versicolor 79 | 6, 2.9, 4.5, 1.5, versicolor 80 | 5.7, 2.6, 3.5, 1, versicolor 81 | 5.5, 2.4, 3.8, 1.1, versicolor 82 | 5.5, 2.4, 3.7, 1, versicolor 83 | 5.8, 2.7, 3.9, 1.2, versicolor 84 | 6, 2.7, 5.1, 1.6, versicolor 85 | 5.4, 3, 4.5, 1.5, versicolor 86 | 6, 3.4, 4.5, 1.6, versicolor 87 | 6.7, 3.1, 4.7, 1.5, versicolor 88 | 6.3, 2.3, 4.4, 1.3, versicolor 89 | 5.6, 3, 4.1, 1.3, versicolor 90 | 5.5, 2.5, 4, 1.3, versicolor 91 | 5.5, 2.6, 4.4, 1.2, versicolor 92 | 6.1, 3, 4.6, 1.4, versicolor 93 | 5.8, 2.6, 4, 1.2, versicolor 94 | 5, 2.3, 3.3, 1, versicolor 95 | 5.6, 2.7, 4.2, 1.3, versicolor 96 | 5.7, 3, 4.2, 1.2, versicolor 97 | 5.7, 2.9, 4.2, 1.3, versicolor 98 | 6.2, 2.9, 4.3, 1.3, versicolor 99 | 5.1, 2.5, 3, 1.1, versicolor 100 | 5.7, 2.8, 4.1, 1.3, versicolor 101 | 6.3, 3.3, 6, 2.5, virginica 102 | 5.8, 2.7, 5.1, 1.9, virginica 103 | 7.1, 3, 5.9, 2.1, virginica 104 | 6.3, 2.9, 5.6, 1.8, virginica 105 | 6.5, 3, 5.8, 2.2, virginica 106 | 7.6, 3, 6.6, 2.1, virginica 107 | 4.9, 2.5, 4.5, 1.7, virginica 108 | 7.3, 2.9, 6.3, 1.8, virginica 109 | 6.7, 2.5, 5.8, 1.8, virginica 110 | 7.2, 3.6, 6.1, 2.5, virginica 111 | 6.5, 3.2, 5.1, 2, virginica 112 | 6.4, 2.7, 5.3, 1.9, virginica 113 | 6.8, 3, 5.5, 2.1, virginica 114 | 5.7, 2.5, 5, 2, virginica 115 | 5.8, 2.8, 5.1, 2.4, virginica 116 | 6.4, 3.2, 5.3, 2.3, virginica 117 | 6.5, 3, 5.5, 1.8, virginica 118 | 7.7, 3.8, 6.7, 2.2, virginica 119 | 7.7, 2.6, 6.9, 2.3, virginica 120 | 6, 2.2, 5, 1.5, virginica 121 | 6.9, 3.2, 5.7, 2.3, virginica 122 | 5.6, 2.8, 4.9, 2, virginica 123 | 7.7, 2.8, 6.7, 2, virginica 124 | 6.3, 2.7, 4.9, 1.8, virginica 125 | 6.7, 3.3, 5.7, 2.1, virginica 126 | 7.2, 3.2, 6, 1.8, virginica 127 | 6.2, 2.8, 4.8, 1.8, virginica 128 | 6.1, 3, 4.9, 1.8, virginica 129 | 6.4, 2.8, 5.6, 2.1, virginica 130 | 7.2, 3, 5.8, 1.6, virginica 131 | 7.4, 2.8, 6.1, 1.9, virginica 132 | 7.9, 3.8, 6.4, 2, virginica 133 | 6.4, 2.8, 5.6, 2.2, virginica 134 | 6.3, 2.8, 5.1, 1.5, virginica 135 | 6.1, 2.6, 5.6, 1.4, virginica 136 | 7.7, 3, 6.1, 2.3, virginica 137 | 6.3, 3.4, 5.6, 2.4, virginica 138 | 6.4, 3.1, 5.5, 1.8, virginica 139 | 6, 3, 4.8, 1.8, virginica 140 | 6.9, 3.1, 5.4, 2.1, virginica 141 | 6.7, 3.1, 5.6, 2.4, virginica 142 | 6.9, 3.1, 5.1, 2.3, virginica 143 | 5.8, 2.7, 5.1, 1.9, virginica 144 | 6.8, 3.2, 5.9, 2.3, virginica 145 | 6.7, 3.3, 5.7, 2.5, virginica 146 | 6.7, 3, 5.2, 2.3, virginica 147 | 6.3, 2.5, 5, 1.9, virginica 148 | 6.5, 3, 5.2, 2, virginica 149 | 6.2, 3.4, 5.4, 2.3, virginica 150 | 5.9, 3, 5.1, 1.8, virginica -------------------------------------------------------------------------------- /03_Python Code/implementation.py: -------------------------------------------------------------------------------- 1 | import csv 2 | import collections 3 | 4 | class DecisionTree: 5 | """Binary tree implementation with true and false branch. """ 6 | def __init__(self, col=-1, value=None, trueBranch=None, falseBranch=None, results=None): 7 | self.col = col 8 | self.value = value 9 | self.trueBranch = trueBranch 10 | self.falseBranch = falseBranch 11 | self.results = results # None for nodes, not None for leaves 12 | 13 | 14 | def divideSet(rows, column, value): 15 | splittingFunction = None 16 | if isinstance(value, int) or isinstance(value, float): # for int and float values 17 | splittingFunction = lambda row : row[column] >= value 18 | else: # for strings 19 | splittingFunction = lambda row : row[column] == value 20 | list1 = [row for row in rows if splittingFunction(row)] 21 | list2 = [row for row in rows if not splittingFunction(row)] 22 | return (list1, list2) 23 | 24 | 25 | def uniqueCounts(rows): 26 | results = {} 27 | for row in rows: 28 | r = row[-1] 29 | if r not in results: results[r] = 0 30 | results[r] += 1 31 | return results 32 | 33 | 34 | def entropy(rows): 35 | from math import log 36 | log2 = lambda x: log(x)/log(2) 37 | results = uniqueCounts(rows) 38 | 39 | entr = 0.0 40 | for r in results: 41 | p = float(results[r])/len(rows) 42 | entr -= p*log2(p) 43 | return entr 44 | 45 | 46 | def gini(rows): 47 | total = len(rows) 48 | counts = uniqueCounts(rows) 49 | imp = 0.0 50 | 51 | for k1 in counts: 52 | p1 = float(counts[k1])/total 53 | for k2 in counts: 54 | if k1 == k2: continue 55 | p2 = float(counts[k2])/total 56 | imp += p1*p2 57 | return imp 58 | 59 | 60 | def variance(rows): 61 | if len(rows) == 0: return 0 62 | data = [float(row[len(row) - 1]) for row in rows] 63 | mean = sum(data) / len(data) 64 | 65 | variance = sum([(d-mean)**2 for d in data]) / len(data) 66 | return variance 67 | 68 | 69 | def growDecisionTreeFrom(rows, evaluationFunction=entropy): 70 | """Grows and then returns a binary decision tree. 71 | evaluationFunction: entropy or gini""" 72 | 73 | if len(rows) == 0: return DecisionTree() 74 | currentScore = evaluationFunction(rows) 75 | 76 | bestGain = 0.0 77 | bestAttribute = None 78 | bestSets = None 79 | 80 | columnCount = len(rows[0]) - 1 # last column is the result/target column 81 | for col in range(0, columnCount): 82 | columnValues = [row[col] for row in rows] 83 | 84 | for value in columnValues: 85 | (set1, set2) = divideSet(rows, col, value) 86 | 87 | # Gain -- Entropy or Gini 88 | p = float(len(set1)) / len(rows) 89 | gain = currentScore - p*evaluationFunction(set1) - (1-p)*evaluationFunction(set2) 90 | if gain>bestGain and len(set1)>0 and len(set2)>0: 91 | bestGain = gain 92 | bestAttribute = (col, value) 93 | bestSets = (set1, set2) 94 | 95 | if bestGain > 0: 96 | trueBranch = growDecisionTreeFrom(bestSets[0]) 97 | falseBranch = growDecisionTreeFrom(bestSets[1]) 98 | return DecisionTree(col=bestAttribute[0], value=bestAttribute[1], trueBranch=trueBranch, falseBranch=falseBranch) 99 | else: 100 | return DecisionTree(results=uniqueCounts(rows)) 101 | 102 | 103 | def prune(tree, minGain, evaluationFunction=entropy, notify=False): 104 | """Prunes the obtained tree according to the minimal gain (entropy or Gini). """ 105 | # recursive call for each branch 106 | if tree.trueBranch.results == None: prune(tree.trueBranch, minGain, evaluationFunction, notify) 107 | if tree.falseBranch.results == None: prune(tree.falseBranch, minGain, evaluationFunction, notify) 108 | 109 | # merge leaves (potentionally) 110 | if tree.trueBranch.results != None and tree.falseBranch.results != None: 111 | tb, fb = [], [] 112 | 113 | for v, c in tree.trueBranch.results.items(): tb += [[v]] * c 114 | for v, c in tree.falseBranch.results.items(): fb += [[v]] * c 115 | 116 | p = float(len(tb)) / len(tb + fb) 117 | delta = evaluationFunction(tb+fb) - p*evaluationFunction(tb) - (1-p)*evaluationFunction(fb) 118 | if delta < minGain: 119 | if notify: print('A branch was pruned: gain = %f' % delta) 120 | tree.trueBranch, tree.falseBranch = None, None 121 | tree.results = uniqueCounts(tb + fb) 122 | 123 | 124 | def classify(observations, tree, dataMissing=False): 125 | """Classifies the observationss according to the tree. 126 | dataMissing: true or false if data are missing or not. """ 127 | 128 | def classifyWithoutMissingData(observations, tree): 129 | if tree.results != None: # leaf 130 | return tree.results 131 | else: 132 | v = observations[tree.col] 133 | branch = None 134 | if isinstance(v, int) or isinstance(v, float): 135 | if v >= tree.value: branch = tree.trueBranch 136 | else: branch = tree.falseBranch 137 | else: 138 | if v == tree.value: branch = tree.trueBranch 139 | else: branch = tree.falseBranch 140 | return classifyWithoutMissingData(observations, branch) 141 | 142 | 143 | def classifyWithMissingData(observations, tree): 144 | if tree.results != None: # leaf 145 | return tree.results 146 | else: 147 | v = observations[tree.col] 148 | if v == None: 149 | tr = classifyWithMissingData(observations, tree.trueBranch) 150 | fr = classifyWithMissingData(observations, tree.falseBranch) 151 | tcount = sum(tr.values()) 152 | fcount = sum(fr.values()) 153 | tw = float(tcount)/(tcount + fcount) 154 | fw = float(fcount)/(tcount + fcount) 155 | result = collections.defaultdict(int) # Problem description: http://blog.ludovf.net/python-collections-defaultdict/ 156 | for k, v in tr.items(): result[k] += v*tw 157 | for k, v in fr.items(): result[k] += v*fw 158 | return dict(result) 159 | else: 160 | branch = None 161 | if isinstance(v, int) or isinstance(v, float): 162 | if v >= tree.value: branch = tree.trueBranch 163 | else: branch = tree.falseBranch 164 | else: 165 | if v == tree.value: branch = tree.trueBranch 166 | else: branch = tree.falseBranch 167 | return classifyWithMissingData(observations, branch) 168 | 169 | # function body 170 | if dataMissing: 171 | return classifyWithMissingData(observations, tree) 172 | else: 173 | return classifyWithoutMissingData(observations, tree) 174 | 175 | 176 | def plot(decisionTree): 177 | """Plots the obtained decision tree. """ 178 | def toString(decisionTree, indent=''): 179 | if decisionTree.results != None: # leaf node 180 | return str(decisionTree.results) 181 | else: 182 | if isinstance(decisionTree.value, int) or isinstance(decisionTree.value, float): 183 | decision = 'Column %s: x >= %s?' % (decisionTree.col, decisionTree.value) 184 | else: 185 | decision = 'Column %s: x == %s?' % (decisionTree.col, decisionTree.value) 186 | trueBranch = indent + 'yes -> ' + toString(decisionTree.trueBranch, indent + '\t\t') 187 | falseBranch = indent + 'no -> ' + toString(decisionTree.falseBranch, indent + '\t\t') 188 | return (decision + '\n' + trueBranch + '\n' + falseBranch) 189 | 190 | print(toString(decisionTree)) 191 | 192 | 193 | def loadCSV(file): 194 | """Loads a CSV file and converts all floats and ints into basic datatypes.""" 195 | def convertTypes(s): 196 | s = s.strip() 197 | try: 198 | return float(s) if '.' in s else int(s) 199 | except ValueError: 200 | return s 201 | 202 | reader = csv.reader(open(file, 'rt')) 203 | return [[convertTypes(item) for item in row] for row in reader] 204 | 205 | 206 | 207 | if __name__ == '__main__': 208 | 209 | # Select the example you want to classify 210 | example = 1 211 | 212 | # All examples do the following steps: 213 | # 1. Load training data 214 | # 2. Let the decision tree grow 215 | # 4. Plot the decision tree 216 | # 5. classify without missing data 217 | # 6. Classifiy with missing data 218 | # (7.) Prune the decision tree according to a minimal gain level 219 | # (8.) Plot the pruned tree 220 | 221 | if example == 1: 222 | # the smaller examples 223 | trainingData = loadCSV('tbc.csv') # sorry for not translating the TBC and pneumonia symptoms 224 | decisionTree = growDecisionTreeFrom(trainingData) 225 | #decisionTree = growDecisionTreeFrom(trainingData, evaluationFunction=gini) # with gini 226 | plot(decisionTree) 227 | 228 | print(classify(['ohne', 'leicht', 'Streifen', 'normal', 'normal'], decisionTree, dataMissing=False)) 229 | print(classify([None, 'leicht', None, 'Flocken', 'fiepend'], decisionTree, dataMissing=True)) # no longer unique 230 | 231 | # Don' forget if you compare the resulting tree with the tree in my presentation: here it is a binary tree! 232 | 233 | else: 234 | # the bigger example 235 | trainingData = loadCSV('fishiris.csv') # demo data from matlab 236 | decisionTree = growDecisionTreeFrom(trainingData) 237 | plot(decisionTree) 238 | 239 | prune(decisionTree, 0.5, notify=True) # notify, when a branch is pruned (one time in this example) 240 | plot(decisionTree) 241 | 242 | print(classify([6.0, 2.2, 5.0, 1.5], decisionTree)) # dataMissing=False is the default setting 243 | print(classify([None, None, None, 1.5], decisionTree, dataMissing=True)) # no longer unique 244 | 245 | 246 | 247 | -------------------------------------------------------------------------------- /03_Python Code/tbc.csv: -------------------------------------------------------------------------------- 1 | hoch, stark, Flocken, normal, blubbernd, Lungenentzuendung 2 | mittel, stark, Flocken, normal, blubbernd, Lungenentzuendung 3 | niedrig, leicht, Punkt, normal, fiepend, Lungenentzuendung 4 | hoch, mittel, Flocken, normal, blubbernd, Lungenentzuendung 5 | mittel, leicht, Flocken, normal, blubbernd, Lungenentzuendung 6 | ohne, leicht, Streifen, normal, normal, Tuberkulose 7 | hoch, stark, Loch, schnell, fiepend, Tuberkulose 8 | niedrig, leicht, Streifen, normal, normal, Tuberkulose 9 | ohne, leicht, Punkt, schnell, fiepend, Tuberkulose 10 | niedrig, mittel, Flocken, schnell, normal, Tuberkulose -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Decision Trees - An Introduction 2 | ============= 3 |

decisiontree

4 | 5 | 6 | Abstract 7 | -------------------- 8 | This project work emerges in the context of the course *Artificial Intelligence* in the winter semester 2013/2014 at [Friedrich-Alexander-University, Erlangen](http://www.fau.eu). Beside this seminar paper, an introductory presentation was conducted and an implementation for decision tree was developed. The presentation is available only in German. 9 | 10 | In the scope of this seminar paper, a small introduction to theory and application of decision trees shall be given. 11 | 12 | After this short introduction a theoretical consideration shall guide to a practical part, which shall clarify the theoretical part by examples. The last part shall summarize and compare the introduced algorithm and shall give a small outlook to not tackled research fields of decision trees. 13 | 14 | On the contrary to the presentation during the seminar, this seminar paper expects a basic knowledge about graph theory, complexity, and machine learning. Instead of an introduction to these underlaying topics, a deeper look inside four decision tree algorithm families shall be given: CHAID, CART, ID3, and C4.5. 15 | 16 | The focus of all Python implementation is on classification. This limitation is not owed to the insufficient importance of regression calculating, but a wider look would push boundaries of this seminar paper. 17 | 18 | 19 | Table of Content 20 | -------------------- 21 | * Introduction 22 | - What is a decision tree? 23 | - Taxonomy 24 | - About this paper 25 | * Theory of Decision Trees 26 | - Definitions 27 | - Decision Tree Learning 28 | - Splitting Criterion 29 | - Stopping Criterion 30 | - Tree Pruning 31 | - Selected Algorithms 32 | - Chi-squared Automatic Interaction Detector (CHAID) 33 | - IterativeDichotomiser 3 (ID3) 34 | - Classification And Regression Tree (CART) 35 | - C4.5 36 | - Discussion 37 | - Advantages 38 | - Disadvantages 39 | - Outlook 40 | - Complexity 41 | - Missing Attributes 42 | - Random Forests 43 | * Summary & Conclusion 44 | - Applications 45 | - Programming Example 46 | - Summary 47 | 48 | 49 | Quicklinks 50 | -------------------- 51 | * [Seminar Paper .pdf](https://raw.githubusercontent.com/michaeldorner/DecisionTrees/master/01_Seminar%20Paper/seminarpaper.pdf) 52 | * [Presentation .pdf (German)](https://raw.githubusercontent.com/michaeldorner/DecisionTrees/master/02_Praesentation/praesentation.pdf) 53 | * [Python source code](https://github.com/michaeldorner/DecisionTrees/tree/master/03_Python%20Code) 54 | 55 | --------------------------------------------------------------------------------